View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
David McRitchie
 
Posts: n/a
Default VBA code to populate 1000's of cells?

Assuming you don't want the values to change once you
place them, since a recalculate event will change them all.
This is macro I use to create 3 digit numbers (up to 3 digits)
as constants within a selection(s).

Sub Random003()
'David McRitchie 2002-08-02
Dim cell As Range
Randomize ' Initialize random-number generator.
For Each cell In Selection
cell.Value = Int(Rnd * 100)
Next cell
End Sub
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

wrote in message ...
Can someone provide a VBA function to populate 1000's
of cells with a simple expression, for example =RAND()?