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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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

hopelessvolunteer

New Member
Joined
Jan 30, 2007
Messages
27
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,191,528
Messages
5,987,112
Members
440,080
Latest member
drhorn4908

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
Top