I have a problem because I have code that copies entire columns, but I would like to change this code to copy only the values under the headers because in the second file I have pivot tables set. copy vintage file but would like to start with A2: C2
wbMe.Sheets("input_4").Range("A:D").ClearContents
wb.Sheets("vintage_agr").Columns("A:C").Copy
wbMe.Sheets("input_4").Range("A1").PasteSpecial Paste:=xlPasteValues
wb.Sheets("vintage_agr").Columns("H").Copy
wbMe.Sheets("input_4").Range("D1").PasteSpecial Paste:=xlPasteValues
CodePudding user response:
This Should work..
wbMe.Sheets("input_4").Range("A:D").ClearContents
wb.Sheets("vintage_agr").Range("A2:C" & rows.count-1).Copy
wbMe.Sheets("input_4").Range("A1").PasteSpecial Paste:=xlPasteValues
wb.Sheets("vintage_agr").Range("H2:H" & rows.count-1).Copy
wbMe.Sheets("input_4").Range("D1").PasteSpecial Paste:=xlPasteValues