billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Need assist If value in Column T is found in Column H copy value adjacent to Column Z range A1
Sub TEST()
Dim TRange As Range, HRange As Range, lz As Long
Dim lt As Long, lh As Long, tcell As Range, hcell As Range
lt = Cells(Rows.Count, "T").End(xlUp).Row
lh = Cells(Rows.Count, "H").End(xlUp).Row
lz = Cells(Rows.Count, "Z").End(xlUp).Row
Set TRange = Range("T2:T" & lt)
Set HRange = Range("H2:H" & lh)
For Each tcell In TRange
For Each hcell In HRange
If hcell.Value = Range("T" & (tcell.Row)).Value Then
Range("Z" & lz).Value = Range("L" & (hcell.Row)).Value
lz = Cells(Rows.Count, "Z").End(xlUp).Row + 1
End If
Next hcell
Next tcell
End Sub
lz = Cells(Rows.Count, "Z").End(xlUp).Row
lz = Cells(Rows.Count, "Z").End(xlUp).Row + 1