View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default random number in VB

Hi
n=Int((56-1 + 1) * Rnd + 1)
n=INT(56*rnd+1)


--
Regards
Frank Kabel
Frankfurt, Germany


swatsp0p wrote:
I am trying to write a macro that will rename a tab and change the
color to a random color. The code I have so far is:

ActiveSheet.Name = "my sheet name here"
ActiveWorkbook.Sheets("my sheet name here").Tab.ColorIndex = n

how can I get the 'n' to be a random number? (I am assuming between
1-56?)

TIA