R
Roger
Hello,
Can you help me to set this macro up so it works between 2 workbooks vs.
just working on the same sheet viewing different columns?
I’m looking for Sheet1 in Workbook A to look for a Match in Sheet2 Workbook
B. I’ve filled in the ranges as they would appear in each of the Workbooks.
Range(“E2:E100â€) is the range in Workbook A looking to match Range(“A2â€A100)
in Workbook B. If match is found, Workbook A Range (“B2:B100â€) would copy
cell values to destination Workbook B Range(“â€C2:C100â€).
Appreciate any help you can provide.
Thanks - Roger
Sub TestCopyFormat()
Dim Cell As Range
Dim Cindex As Integer
On Error GoTo errorhandler
Application.DisplayAlerts = False
With Worksheets("Sheet1")
For Each Cell In Range("E2:E100")
Cindex = WorksheetFunction.Match(Cell.Text, .Range("A2:A100"), 0)
.Range("B2:B100").Cells(Cindex, 1).Copy _
Destination:=Range("C2:C100").Cells(Cindex, 1)
Next Cell
End With
errorhandler:
Application.DisplayAlerts = True
End Sub
Can you help me to set this macro up so it works between 2 workbooks vs.
just working on the same sheet viewing different columns?
I’m looking for Sheet1 in Workbook A to look for a Match in Sheet2 Workbook
B. I’ve filled in the ranges as they would appear in each of the Workbooks.
Range(“E2:E100â€) is the range in Workbook A looking to match Range(“A2â€A100)
in Workbook B. If match is found, Workbook A Range (“B2:B100â€) would copy
cell values to destination Workbook B Range(“â€C2:C100â€).
Appreciate any help you can provide.
Thanks - Roger
Sub TestCopyFormat()
Dim Cell As Range
Dim Cindex As Integer
On Error GoTo errorhandler
Application.DisplayAlerts = False
With Worksheets("Sheet1")
For Each Cell In Range("E2:E100")
Cindex = WorksheetFunction.Match(Cell.Text, .Range("A2:A100"), 0)
.Range("B2:B100").Cells(Cindex, 1).Copy _
Destination:=Range("C2:C100").Cells(Cindex, 1)
Next Cell
End With
errorhandler:
Application.DisplayAlerts = True
End Sub