Akashwani
Well-known Member
- Joined
- Mar 14, 2009
- Messages
- 2,911
Hi,
I have the following code which works great for one sheet.
I now have X sheets (to the left of Master) that I need to run this code on. I have worksheets to the right of Master that do not need copying.
I know that I could just change the sheet name from Inbound and create X number of macros and run them one after another, but I have a feeling that it will take sometime to go through all the sheets.
Any suggestions?
Thanks
Ak
I have the following code which works great for one sheet.
Code:
Sub CopyInboundData()
Dim lr As Long
Dim lr2 As Long
Application.ScreenUpdating = False
Sheets("Inbound").Unprotect ("Password1")
Sheets("Master").Unprotect ("Password1")
lr = Sheets("Master").Cells(Rows.Count, 1).End(xlUp).Row + 1
lr2 = Sheets("Inbound").Cells(Rows.Count, 1).End(xlUp).Row ' + 1
Sheets("Inbound").Range("A2:AJ" & lr2).Copy
Sheets("Master").Activate
Range("A" & lr).PasteSpecial xlValues
Sheets("Master").Protect ("Password1")
Sheets("Inbound").Select
Sheets("Inbound").Protect ("Password1")
Sheets("Master").Select
Application.ScreenUpdating = True
End Sub
I now have X sheets (to the left of Master) that I need to run this code on. I have worksheets to the right of Master that do not need copying.
I know that I could just change the sheet name from Inbound and create X number of macros and run them one after another, but I have a feeling that it will take sometime to go through all the sheets.
Any suggestions?
Thanks
Ak