Neil
Thanks for the reply, can I apply this to only one worksheet instead of the
"active sheet", by replacing
ActiveSheet.Range("M17:M50") with
("DataInput").Range("M17:M50")?
Mike Rogers
"Neil" wrote:
Mike,
Adding a line at the start of oyur macro will do the trick
Sub Macro1()
ActiveSheet.Range("M17:M50").Select
Dim myCell As Range
For Each myCell In Selection.Cells
myCell.FormulaR1C1 = "=TEXT(ROUND(10000*RAND(),0),""0000"")"
Next myCell
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End Sub
HTH
Neil
www.nwarwick.co.uk
"Mike Rogers" wrote:
Good evening:
I have the following macro that "Sloth" was good enough to help me with and
now I need a little change. This now needs to generate these random numbers
in the same place when a button is used. What do I change to make the new
set always appear in the range of M17:M50
Sub Macro1()
Dim myCell As Range
For Each myCell In Selection.Cells
myCell.FormulaR1C1 = "=TEXT(ROUND(10000*RAND(),0),""0000"")"
Next myCell
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End Sub
Thank you very much!!!
Mike Rogers