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 |
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 |
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 |
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 |
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 |
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 |
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 |
|
All times are GMT +1. The time now is 09:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com