View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Msgbox with randomly picked text

sub ABC()
set rng = Range("A1:A3")
i = int(rnd()*rng.count + 1)
msgbox rng(i)
End Sub

--
Regards,
Tom Ogilvy


"Cajeto 63" wrote:

Hello everybody,

I would like to create a message box with random message picked from a list
preset in the cells of the workbook itself. May be the example below will be
more clear:

On sheet2:
Cell A1= blablabla
cell A2= totototo
cell A3= yepyepyep

Then the message box would give either the text in A1 or A2 or A3.

As my knowledge in VBA is quite limited it would be very nice if one of you
could give me a hand.

Thank you.