Hello,
I have written the below macro to copy data from a sheet called "Fixit Example 1" to a sheet called "Fixit Summary Example". It works fine, but I'd like to be able to run it from any "Fixit Example XX" worksheet. As written, the data is always copied from "Fixit Example 1" regardless of what worksheet I have open.
I tried replacing
Windows("Fixit Example 1.xls").Activate
with
Windows(Active.Worksheet).Activate
but got an error "Run time error 424. Object required."
I have written the below macro to copy data from a sheet called "Fixit Example 1" to a sheet called "Fixit Summary Example". It works fine, but I'd like to be able to run it from any "Fixit Example XX" worksheet. As written, the data is always copied from "Fixit Example 1" regardless of what worksheet I have open.
I tried replacing
Windows("Fixit Example 1.xls").Activate
with
Windows(Active.Worksheet).Activate
but got an error "Run time error 424. Object required."
Code:
Sub MoveData()
'
' MoveData Macro
' Macro recorded 18/03/2009
'
' Keyboard Shortcut: Ctrl+m
'
Windows("Fixit Summary Example.xls").Activate
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Windows("Fixit Example 1.xls").Activate
Range("A2").Select
Selection.Copy
Windows("Fixit Summary Example.xls").Activate
Range("A2").Select
ActiveSheet.Paste
Windows("Fixit Example 1.xls").Activate
Range("A5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Fixit Summary Example.xls").Activate
Range("B2").Select
ActiveSheet.Paste
Windows("Fixit Example 1.xls").Activate
Range("C2").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Fixit Summary Example.xls").Activate
Range("C2").Select
ActiveSheet.Paste
Windows("Fixit Example 1.xls").Activate
Range("C5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Fixit Summary Example.xls").Activate
Range("D2").Select
ActiveSheet.Paste
Range("E5").Select
End Sub
Last edited by a moderator: