Neil
Thanks for the reply, can I apply this to only one worksheet instead of the
quot;active sheetquot;, by replacing
ActiveSheet.Range(quot;M17:M50quot;) with
(quot;DataInputquot;).Range(quot;M17:M50quot;)?
Mike Rogers
quot;Neilquot; wrote:
gt; Mike,
gt;
gt; Adding a line at the start of oyur macro will do the trick
gt;
gt; Sub Macro1()
gt; ActiveSheet.Range(quot;M17:M50quot;).Select
gt; Dim myCell As Range
gt; For Each myCell In Selection.Cells
gt; myCell.FormulaR1C1 = quot;=TEXT(ROUND(10000*RAND(),0),quot;quot;0000quot;quot;)quot;
gt; Next myCell
gt; Selection.Copy
gt; Selection.PasteSpecial Paste:=xlValues
gt; Application.CutCopyMode = False
gt;
gt; End Sub
gt;
gt; HTH
gt;
gt;
gt; Neil
gt; www.nwarwick.co.uk
gt;
gt; quot;Mike Rogersquot; wrote:
gt;
gt; gt; Good evening:
gt; gt;
gt; gt; I have the following macro that quot;Slothquot; was good enough to help me with and
gt; gt; now I need a little change. This now needs to generate these random numbers
gt; gt; in the same place when a button is used. What do I change to make the new
gt; gt; set always appear in the range of M17:M50
gt; gt;
gt; gt; Sub Macro1()
gt; gt; Dim myCell As Range
gt; gt; For Each myCell In Selection.Cells
gt; gt; myCell.FormulaR1C1 = quot;=TEXT(ROUND(10000*RAND(),0),quot;quot;0000quot;quot;)quot;
gt; gt; Next myCell
gt; gt; Selection.Copy
gt; gt; Selection.PasteSpecial Paste:=xlValues
gt; gt; Application.CutCopyMode = False
gt; gt;
gt; gt; End Sub
gt; gt;
gt; gt; Thank you very much!!!
gt; gt;
gt; gt; Mike Rogers
- Oct 18 Sat 2008 20:47
Help with changing a Macro
close
全站熱搜
留言列表
發表留言