Thomas Kuriakose
Active Member
Respected Sirs,
I tried a macro to copy specific columns from one sheet (Sheet1) to another (Sheet2). I am using the below code -
The requirement is to paste special values in Sheet2, but I get the below run time error in line
src.Range("B4:B2000").Copy Destination:=trg.Range("A5").PasteSpecial
Kindly guide on how to write the correct code to copy and paste special value in this case.
Thank you very much for you support always,
much appreciated,
with regards,
thomas
I tried a macro to copy specific columns from one sheet (Sheet1) to another (Sheet2). I am using the below code -
Code:
Sub Copy()
Dim src As Worksheet
Dim trg As Worksheet
Dim LastRow As Long
Set src = ThisWorkbook.Worksheets("Sheet1")
Set trg = ThisWorkbook.Worksheets("Sheet2")
src.Range("B4:B2000").Copy Destination:=trg.Range("A5").PasteSpecial
src.Range("GN4:GN2000").Copy Destination:=trg.Range("B5").PasteSpecial
src.Range("HD4:HD2000").Copy Destination:=trg.Range("C5").PasteSpecial
src.Range("HE4:HE2000").Copy Destination:=trg.Range("D5").PasteSpecial
src.Range("HB4:HB2000").Copy Destination:=trg.Range("E5").PasteSpecial
src.Range("HC4:HC2000").Copy Destination:=trg.Range("F5").PasteSpecial
src.Range("DC4:DC2000").Copy Destination:=trg.Range("G5").PasteSpecial
src.Range("DD4:DD2000").Copy Destination:=trg.Range("H5").PasteSpecial
src.Range("DG4:DG2000").Copy Destination:=trg.Range("I5").PasteSpecial
src.Range("EN4:EN2000").Copy Destination:=trg.Range("J5").PasteSpecial
src.Range("DN4:DN2000").Copy Destination:=trg.Range("K5").PasteSpecial
src.Range("EU4:EU2000").Copy Destination:=trg.Range("L5").PasteSpecial
src.Range("DJ4:DJ2000").Copy Destination:=trg.Range("N5").PasteSpecial
Application.CutCopyMode = False
Sheet2.Columns().AutoFit
End Sub
The requirement is to paste special values in Sheet2, but I get the below run time error in line
src.Range("B4:B2000").Copy Destination:=trg.Range("A5").PasteSpecial
Kindly guide on how to write the correct code to copy and paste special value in this case.
Thank you very much for you support always,
much appreciated,
with regards,
thomas