View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cajeto 63 Cajeto 63 is offline
external usenet poster
 
Posts: 26
Default Label with randomly selected text from cells

Hello everybody,

I was given the following code yesterday by Tom Ogilvy to select a text
randomly from a list of cells in a message box.

Sub Text()

Set rng = Sheets("sheet2").Range("A1:A5")
i = Int(Rnd() * rng.Count + 1)
MsgBox rng(i)

End Sub


The question is how can I do the same for the text of a label in a userform?
Thank you for your help.