I’m having three columns in my workbook where my data starts from the 8th row of the sheet named “Salesâ€.
I have written a macro code where I’m trying to copy data from the columns A, B, C, & D of the worksheet “Sales†to the columns G, H, I & J of the sheet “SavedDataâ€.
In the Sheet “SavedData†I want the copied columns to start from the first empty row each time I copy them from the sheet “Salesâ€.
In the column A I have the text “Product name†which I don’t want to get copied into column "H" also in column "B" I have the text “result†which I don’t want to get copied into the Column “Hâ€. And in column C I have “Units†which I don’t want to get copied into column “I†And in column “Dâ€, I have the text “reference†which I don’t want to get copied into the column "J" of the worksheet “SavedDataâ€
The code I have written only copies the data in the column D of the worksheet "sales" to the three columns G,H,I & J of the sheet "savedData". and it does not stop copying the text I have mentioned above.
Any help to point out what I have done wrong in my coding would be kindly appreciated.
Thanks in advance.
Code: Select all
Sub CopyDataToSavedData()
Sheets("Sales").Select
Range("A8:A100").Select
Range("B8:B100").Select
Range("C8:C100").Select
Range("D8:D100").Select
Selection.Copy
Sheets("SavedData").Select
ActiveSheet.[G65536].End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Copy
Sheets("SavedData").Select
ActiveSheet.[H65536].End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Copy
Sheets("SavedData").Select
ActiveSheet.[H65536].End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Copy
Sheets("SavedData").Select
ActiveSheet.[ID65536].End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Copy
Sheets("SavedData").Select
ActiveSheet.[J65536].End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub