i am new in macro and VBA coding.
I have two workbooks. one is report.xls, another one is AT.xlsm.
In report.xls, there has the sheet called "Service".
In AT.xlsm, there has the sheet called "Worksheet".
I want to auto copy the column B,C,F,J,E,D expect first row of report to the column A,C,D,E,F,H of AT. So, i try to record a macro and revise the code, it can copy and paste but it saved to same location.
Would you please tell me how to paste to new row?
Thank you very much.
Code:
Sub Module1()
'Hot key: Ctrl+Shift+G
Windows("report.xls").Activate
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("AT.xlsm").Activate
ActiveSheet.Paste
Windows("report.xls").Activate
Range("C2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("C5380").Select
ActiveSheet.Paste
Windows("report.xls").Activate
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("D5380").Select
ActiveSheet.Paste
Windows("report.xls").Activate
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("E5380").Select
ActiveSheet.Paste
Windows("report.xls").Activate
Range("E2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("F5380").Select
ActiveSheet.Paste
Windows("report.xls").Activate
Range("D2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("H5380").Select
ActiveSheet.Paste
Windows("report.xls").Activate
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("AT.xlsm").Activate
Range("J5380").Select
ActiveSheet.Paste
Range("F5380").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Replace What:="[S]", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub