Thread: VBA help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Soccerboy83 Soccerboy83 is offline
external usenet poster
 
Posts: 21
Default VBA help

My question is this, i have a forumula in VBA that reads as follows,


Public Function RandomNumbers(Lowest As Long, Highest As Long)
If IsMissing(Decimals) Or Decimals = 0 Then
Randomize
RandomNumbers = Int((Highest + 1 - Lowest) * Rnd + Lowest)
Else
Randomize
RandomNumbers = Round((Highest - Lowest) * Rnd + Lowest, Decimals)
End If
End Function

However when i try and run the program it is giving me problems. It keeps
telling Highlighting (Decimals) and gives me an compilation error, saying it
cannot find it in the project or Library. Can someone please help me. or
give me another way of writing the code above to give me a random number,
that does not recalculate every time something changes. Thanks,