Hello - in the following code it is suppose to take the values in column B on activesheet one at a time and perform a search of that value on sheet (SMs), returning it and the values of neighboring cells back to active sheet. I can not get it to work as is...right now I am getting the "next without for" error, BUT I have both "for" and "next."
Any help would be appreciated - Jim Ayers
Code:
Sub lookUp_ALL_in_Column2()
Application.ScreenUpdating = False
Dim pFind As Range
Dim Lastrow As Long
Dim i As Integer
Dim C As Range
Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
With ActiveSheet
For i = 1 To Lastrow
b:
Set C = Cells(i, 2)
If C <> Application.xlnull Then
Set pFind = Sheets("SMs").Range("E:E").find(What:=C.Value, LookIn:=xlValues, LookAt:=xlWhole)
If pFind Is Nothing Then
'MsgBox ("CD#" & C & " not found on SOMs Sheet.")
C.Offset(, -1).Interior.ColorIndex = 6
GoTo b:
End If
C.Offset(0, -1).Value = pFind.Offset(0, -4)
C.Value = pFind.Value
C.Offset(0, 1).Value = pFind.Offset(0, 6)
Next
End If
End With
Application.ScreenUpdating = True
End Sub
Any help would be appreciated - Jim Ayers