Random Pick

hopelessvolunteer

New Member
Joined
Jan 30, 2007
Messages
27
Can someone please help me with this.

I have a list of name with a header row in column A, could be up to 50 names. I would like a macro that would randomly pick one name from the column. :eek:

I will have 4 worksheets in the work book, and I want to be able to run the same macro on each worksheet, but only when I tell it to.

Thanks so much in advance. :biggrin:
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
This should give you a start

Code:
Sub test()
LR = Cells(Rows.Count, "A").End(xlUp).Row

Dim MyValue
Randomize
MyValue = Int((LR * Rnd) + 1)
MsgBox Cells(MyValue, "A")
End Sub
 
Upvote 0
Thanks, looks like that one will work.

But, when I try to run it, I get an error message that says: Microsoft Visual Basic - Out of Memory. :devilish:

Any suggestions on how to fix this?

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,182
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top