RoseChapman
New Member
- Joined
- Jun 12, 2018
- Messages
- 40
Hi, could anyone help me, please?
I have to copy from the Test2 spreadsheet from column AG to AJ and from column AL to BB and paste them in test 1 spreadsheet. The table array in Test 2 is E:BB. The formula below copy all columns, but I do not need to paste all columns I just need the ones I've mentioned above. What shall I include in the formula to be able to get what I need? many thanks for your help.
Sub Test()
For i = 8 To 100
For j = 1 To 22
On Error Resume Next
Sheets("Test1").Cells(i, j + 5).Value = Application.WorksheetFunction.VLookup(Sheets("Test1").Cells(i, 1).Value, Sheets("Test2").Range("E:BB"), j + 28, False)
On Error GoTo 0
Next j
Next i
End Sub
I have to copy from the Test2 spreadsheet from column AG to AJ and from column AL to BB and paste them in test 1 spreadsheet. The table array in Test 2 is E:BB. The formula below copy all columns, but I do not need to paste all columns I just need the ones I've mentioned above. What shall I include in the formula to be able to get what I need? many thanks for your help.
Sub Test()
For i = 8 To 100
For j = 1 To 22
On Error Resume Next
Sheets("Test1").Cells(i, j + 5).Value = Application.WorksheetFunction.VLookup(Sheets("Test1").Cells(i, 1).Value, Sheets("Test2").Range("E:BB"), j + 28, False)
On Error GoTo 0
Next j
Next i
End Sub