Hi contra76,
I set the 'lngLastRow' variable based on the last row in Column A where it seems in this case it should have been Column B. In any case, try the following which finds the last row regardless of what Column it resides in:
Sub Macro1()
Dim lngLastRow As Long
Dim rngCell As Range, _
rngMyRange As Range
'Find the last row by searching backwards through all the rows.
lngLastRow = ActiveSheet.Cells.Find(What:="*", _
After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Set rngMyRange = Range("A2:A" & lngLastRow) 'Assumes the data starts from Row 2. Change to suit.
Application.ScreenUpdating = False
For Each rngCell In rngMyRange
If Len(rngCell.Value) = 0 Then
rngCell.Value = rngCell.Offset(0, 1).Value
End If
Next rngCell
Application.ScreenUpdating = True
End Sub
Also, have you tried JBeaucaire's clever solution as for large datasets it is the way to go.
Regards,
Robert
Bookmarks