Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Macro with Range of Worksheets
This is probably simple to do, but I don't do this enough to know.
How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#2
|
|||
|
|||
try this idea
Sub copytosheets() For i = 3 To Sheets.Count Sheets(i).Range("a1") = Range("a1") Next End Sub -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#3
|
|||
|
|||
I don't understand where to put this in the macro.
"Don Guillett" wrote: try this idea Sub copytosheets() For i = 3 To Sheets.Count Sheets(i).Range("a1") = Range("a1") Next End Sub -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#5
|
|||
|
|||
I cannot get this to work.
"Don Guillett" wrote: That IS the macro -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... I don't understand where to put this in the macro. "Don Guillett" wrote: try this idea Sub copytosheets() For i = 3 To Sheets.Count Sheets(i).Range("a1") = Range("a1") Next End Sub -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#6
|
|||
|
|||
One way:
If you're trying to copy from sheet "1" to Sheet "4" and subsequent sheets, and they're in order: Public Sub CopySkipPaste() Dim rCopy As Range Dim i As Long Set rCopy = Sheets("1").Range("G14") For i = 4 to Worksheets.Count rCopy.Copy Destination:=Sheets(i).Range("G14") Next i End Sub In article , "Chris E." <Chris wrote: This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#7
|
|||
|
|||
Bingo. Thank you
"JE McGimpsey" wrote: One way: If you're trying to copy from sheet "1" to Sheet "4" and subsequent sheets, and they're in order: Public Sub CopySkipPaste() Dim rCopy As Range Dim i As Long Set rCopy = Sheets("1").Range("G14") For i = 4 to Worksheets.Count rCopy.Copy Destination:=Sheets(i).Range("G14") Next i End Sub In article , "Chris E." <Chris wrote: This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#8
|
|||
|
|||
Sub selectsheetindex()
'Sheets(1).Select 'gets 1st in line Sheet1.Select 'gets index number End Sub The macro must be put in a regular module vs a sheet module. It WILL take the value of whatever is in cell a1 of the sheet from where executed (sheet 1 or 2 would be nice) and place in all but the 1st two sheets based on where they are in the workbook. The 1st 2 tabs. So, it assumed you would have 11111 in cell a1 of sheet 1 and execute the macro from that sheet. Now that sheet and the next one will not be changed but all the others will. Send your email to my email and I will send you a sample workbook where it works. -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... I cannot get this to work. "Don Guillett" wrote: That IS the macro -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... I don't understand where to put this in the macro. "Don Guillett" wrote: try this idea Sub copytosheets() For i = 3 To Sheets.Count Sheets(i).Range("a1") = Range("a1") Next End Sub -- Don Guillett SalesAid Software "Chris E." <Chris wrote in message ... This is probably simple to do, but I don't do this enough to know. How would I edit this macro to paste to a range of 134 worksheets that are after two that I do not want to paste to. In this example I have gone to each worksheet and pasted one at a time. Range("G14").Select Selection.Copy Sheets("2").Select Range("G14").Select ActiveSheet.Paste Sheets("3").Select Range("G14").Select ActiveSheet.Paste Sheets("4").Select Range("G14").Select ActiveSheet.Paste |
#9
|
|||
|
|||
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro does not run when data refreshed | Excel Discussion (Misc queries) | |||
HELP! How do you--> Lock a set of rows but also link worksheets to | Excel Discussion (Misc queries) | |||
named range refers to: in a chart | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) | |||
Macro for Show/Hide Range | Excel Discussion (Misc queries) |