LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Mike Rogers
 
Posts: n/a
Default Help with changing a Macro

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"