Formula in macro help
Doug's approach is more efficient, actually.
--
Vasant
"Biff" wrote in message
...
Thanks Vasant. Perfect!
Biff
"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
One way, if you have the range selected:
Sub Test()
With Selection
.Formula = "=ROUND(RAND()*100,0)"
.Copy
.PasteSpecial xlValues
End With
'Application.CutCopyMode = False
End Sub
Or you could just use Range("A1:A2") or equivalent insead of Selection.
This would be better as there would be no need then to select the range.
Regards,
Vasant
"Biff" wrote in message
...
Hi Folks!
I use this formula extensively for testing:
=ROUND(RAND()*100,0)
That simply generates random 2 digit integers.
What I would like is a macro that will insert that formula into the
selected range then do the equivalent of CopyPaste SpecialValues.
It doesn't necessarily have to "insert that formula" just so the macro
generates random 2 digit ints in the selected range.
I use this so often it makes sense to have a macro that I can attach to
a toolbar button.
Thanks!
Biff
|