Good morning and i hope someone is able to help.
I have a couple of hundred customer spreadsheets with their product prices on and we are implementing a price increase, so I have a formula in a different spreadsheet which I copy into each customers spreadsheet which changes all their prices. I set this up as a macro to copy and paste the formula but I am having problems where the macro only references the current spreadsheet. if I open a new customers spreadsheet and run the same macro, I hit an error and I think it is the Windows("Test1.xlsx").Activate part below. Is there a way to reference ("current open spreadsheet") for example?
I am sure there are easier ways to achieve what I am looking to do, I just want to cut down on the repetitive work.
many thanks
-----------------
Sub Copy()
'
' Copy Macro
'
' Keyboard Shortcut: Ctrl+a
'
Windows("Copy of CCP-price increase formula-Sheet2").Activate
Selection.Copy
Windows("Test1.xlsx").Activate
ActiveSheet.Paste
Range("H2:J2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("H2:J885")
Range("H2:J885").Select
End Sub
I have a couple of hundred customer spreadsheets with their product prices on and we are implementing a price increase, so I have a formula in a different spreadsheet which I copy into each customers spreadsheet which changes all their prices. I set this up as a macro to copy and paste the formula but I am having problems where the macro only references the current spreadsheet. if I open a new customers spreadsheet and run the same macro, I hit an error and I think it is the Windows("Test1.xlsx").Activate part below. Is there a way to reference ("current open spreadsheet") for example?
I am sure there are easier ways to achieve what I am looking to do, I just want to cut down on the repetitive work.
many thanks
-----------------
Sub Copy()
'
' Copy Macro
'
' Keyboard Shortcut: Ctrl+a
'
Windows("Copy of CCP-price increase formula-Sheet2").Activate
Selection.Copy
Windows("Test1.xlsx").Activate
ActiveSheet.Paste
Range("H2:J2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("H2:J885")
Range("H2:J885").Select
End Sub