-
WSEwan Deans
AskWoody LoungerThere is a work around, IF you can use VBA. The following…
Range(“Database”).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=””, _
CopyToRange:=Range(“Extract”), Unique:=TrueWill copy a unique list of cities to the Extract range, providing the sheet for this range is on is active at the time. I achieved this simply by creating a button on the same sheet as the Extract range then sticking the above to it’s click event. My advice is DO NOT assign a keyboard shortcut to it. That way the you have to have the Extract sheet active to click the button.
An advantage is you can have an Extract range on a sheet all on it’s own, so your extracted list can be as long as you like (up to Excel’s limit of rows). Placing the text “Cities” in cell A4 and naming it “Extract” will work. Just remember that all previous data below A4 will be wiped. I know it’s VBA but it’s a tip all the same for anyone else.
Ewan -
WSEwan Deans
AskWoody LoungerHey i thought that was simple VBA!!!
It sounds as though you need to look into EVENT procedures. This is not as scary as it sounds. Use the VB tool bar to activate the editor and then double click your sheet name. This will bring up the code window on the right of the screen. At the top of the window there are two drop down boxes. The left hand one will probably have “(General)” and the right one will say “(Declarations)”. Bring down the left hand list and select “Worksheet”, the right hand one will probably change to “Selection Change” and the bare bones of a Worksheet_SelectionChange sub-routine will appear, feel free to delete it. Bring down the right hand list and select “Calculation”, now a Worksheet_Calculation procedure is created. Inside you fill in the procedure to something like:Private Sub Worksheet_Calculate()
Dim MyVariant AS VariantMyVariant=RandList(4,4)
‘Your code goes here
‘for example
Worksheets(“Sheet1”).Range(“A1”).Value = MyVariant(1)
‘will place the first value in MyVariant into A1 on sheet1End Sub
And don’t forget to paste in my RandList function above the procedure!! The procedure will be run everytime the sheet is recalculated and a different random order of 1234 will be generated. You don’t say what you want with the array generated e.g. to be stuck in a cell as an array formula or the individual values placed in different locations. As an afterthought i use office 97 but i don’t imagine it’s much different for 2000 (this where 2000 users make a
of me!!).
Ewan -
WSEwan Deans
AskWoody LoungerI’ve decided to use a check box. It’s more discrete than some big grey toggle button and doesn’t require playing around with user settings (which can upset some!!) or putting buttons on the document to specifically hide controls during printing/print certain sections. I am assuming there is no equivalent to a print range in Excel, where once you name it you can leave it alone.
Thanks for the input everyone,
Ewan
P.S. Could start a whole new thread on features in one office app that should be in the others!! -
WSEwan Deans
AskWoody LoungerHi bob,
I wrote the following function for an exam generator (see post on preventing controls printing). I needed to randomly select questions from a list, without ever repeating a question and to randomise the order the answers appear, else the students would gradually associate the position of an answer to a given question. To produce a list of unique numbers in the range 1 to 4 call the function with MyVariant=RandList(4,4) and then step through the array assigned to MyVariant.Function RandList(ByVal MaxListValue As Long, Optional ByVal ListSize As Long) As Variant
‘Produces a list of unique numbers, in the range 1 to MaxlistValue
‘The size of the list being 1 to ListSize or MaxListValue, whichever is smaller
‘The list is stored in ListArray
Dim ListArray() As Long
Dim AvailableValues() As Long
Dim counter As Long
Dim ListArraySize
Dim RandNumber As Long‘Initialise AvailableValues to array of 1 to MaxListValue and fill array with values 1 to MaxListValue
ReDim AvailableValues(1 To MaxListValue) As Long
For counter = 1 To MaxListValue
AvailableValues(counter) = counter
Next‘Determine size of array to be returned by function
If ListSize > MaxListValue Then
ListArraySize = MaxListValue
Else
ListArraySize = ListSize
End If
ReDim ListArray(1 To ListArraySize) As LongFor counter = 1 To ListArraySize
‘Get a RandNumber between 1 and upper limit of AvailableValues
Randomize
RandNumber = Int(UBound(AvailableValues) * Rnd + 1)ListArray(counter) = AvailableValues(RandNumber)
‘Swap last item with selected item
AvailableValues(RandNumber) = AvailableValues(UBound(AvailableValues))‘Shrink size of AvailableValues by 1 to get rid of used number
If UBound(AvailableValues) > 1 Then
ReDim Preserve AvailableValues(1 To UBound(AvailableValues) – 1)
End If
NextRandList = ListArray
End FunctionThe function has the advantage of taking the same time for a given size of list. This could be important as list sizes increase and the size of list approaches or equals that of the available values. The disadvantage is memory used up as list size increases but i doubt this would be a factor in your case. Hope it helps,
Ewan -
WSEwan Deans
AskWoody LoungerThanks for the replies. I think i need to explain a bit more…
I’m generating a multi-choice exam using an excel database of questions and responses. A VBA routine randomly selects a requested number of unique questions and scrambles the answers. A Word doc is used to hold the questions and answers, plus any graphic and the correct response. So the whole list of questions would be in the format:-Some question here?
Response A goes here
Response B goes here
Response C goes here
Response D goes here
Correct reponse is: A – DThe questions are formated as Heading 1style, the choices as Heading 2 style and the correct response para (which also holds any inline graphic) as Heading 3 style. Headings 1 and 2 are set up to outline number and Heading 3 has no number but does have a bottom border. The whole thing works very well, with all questions and responses automatically numbering and lettering plus any graphics below the last reponse being exactly the same width as the column. To toggle between hiding and showing the correct answers i placed a toggle button at the top of the first page to switch the font colour of the Heading 3 style between white and auto.
I checked the FAQ and the text box technique is intresting (if a pain in the ass) but it assumes i want a button for printing. To get the sample code to work i would need to place a button on the document for printing. I even checked for event procedures like Before_print in excel, but no luck. All these things that are in one App but not another is enough to drive you
!!
-
WSEwan Deans
AskWoody LoungerHey Andrew
I can’t replicate the error, but good idea. I’ll alert the user to try it if it occurs again
Thanks for the help everyone
Ewan -
WSEwan Deans
AskWoody LoungerHello pieterse,
To my knowledge the user was stuck with looking at one sheet. The behaviour was as if someone had disabled sheet tabs from Tools>Options. Luckily it was a data entry sheet that was active, they just couldn’t click a tab to jump to a summary sheet.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 hour, 50 minutes ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 hours, 56 minutes ago -
0Patch, where to begin
by
cassel23
2 hours, 42 minutes ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
16 hours, 34 minutes ago -
89 million Steam account details just got leaked,
by
Alex5723
4 hours, 20 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
1 day, 1 hour ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
16 hours, 6 minutes ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
3 hours, 13 minutes ago -
Installer program can’t read my registry
by
Peobody
4 hours, 6 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
13 hours, 53 minutes ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
21 hours, 13 minutes ago -
False error message from eMClient
by
WSSebastian42
1 day, 12 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
1 day, 21 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
1 day, 22 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
19 hours, 8 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
2 days, 2 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
1 day, 3 hours ago -
Outdated Laptop
by
jdamkeene
2 days, 7 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
2 days, 12 hours ago -
Another big Microsoft layoff
by
Charlie
2 days, 12 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
9 hours, 57 minutes ago -
May 2025 updates are out
by
Susan Bradley
52 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
2 days, 18 hours ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
2 days, 18 hours ago -
Drivers suggested via Windows Update
by
Tex265
2 days, 18 hours ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
14 hours, 33 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
3 days, 1 hour ago -
Apple releases 18.5
by
Susan Bradley
2 days, 19 hours ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
3 days, 2 hours ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
3 days, 3 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.