Just in case needed ... perhaps some steps to ease you in?
Press Alt + F11 to go to VBE
Click Insert > Module
Copy > Paste
everything within the dotted lines below
[from "begin vba" till "end vba"]
into the empty white space on the right side in VBE
---------begin vba----------
Sub RandomName()
' Generates a random pick from a list in Sheet1, in A1:A10
' and puts the value in cell B1 of the activesheet.
' Max .newusers 9 Feb '04
With Range("B1")
.FormulaR1C1 = _
"=OFFSET(Sheet1!RC[-1],RANDBETWEEN(0,9),0)"
.Value = Range("B1").Value
End With
End Sub
---------end vba----------
Press Alt + Q to exit and return to Excel
Now to trial-run the macro
---------------------------------
In any sheet with *cell B1 empty*
in the same book where you have the names listed in Sheet1, A1:A10
-----------------------------------------
Press Alt + F8
(this brings up the "Macro" dialog)
Click on the macro "RandomName" > Run
(or just double click on "RandomName")
A random name will be generated & placed in cell B1
Repeating the macro run will generate another random name in B1
which will overwrite the previous one
(Note that duplicate names are possible)
Alternatively, to run the macro,
draw a button on the sheet from the Forms Toolbar
(If necessary, activate the toolbar via View > Toolbars > Forms)
The Assign Macro dialog will pop-up automatically
[You can also right-click on an existing button > Assign Macro]
Select "RandomName" > OK
Rename the button as say, "Generate Random Name"
Each click on the button will run the macro,
with a random name generated in cell B1, as before.