Hi,
I have the following code which is working, however I need to keep running the Macro for each line for it to work properly. When I put it into a Do Until Loop I get an error on every line (I've added my code that I am typing for the loop as a comment on the code below). How can I knock this out into a do until loop without getting errors on each line?
Sub LookingUp()
Dim Luk As String
Dim Sal As Variant
Luk = ActiveCell.Offset(0, -2)
'Do Until ActiveCell.Offset(0, -2) = ""
On Error Resume Next
Sal = Application.WorksheetFunction.VLookup(Luk, Sheets("Sheet1").Range("E:F"), 2, False)
If Err.Number = 0 Then
ActiveCell.Value = Sal
Else
ActiveCell = "Error"
End If
ActiveCell.Offset(1, 0).Select
'Loop
End Sub
I have the following code which is working, however I need to keep running the Macro for each line for it to work properly. When I put it into a Do Until Loop I get an error on every line (I've added my code that I am typing for the loop as a comment on the code below). How can I knock this out into a do until loop without getting errors on each line?
Sub LookingUp()
Dim Luk As String
Dim Sal As Variant
Luk = ActiveCell.Offset(0, -2)
'Do Until ActiveCell.Offset(0, -2) = ""
On Error Resume Next
Sal = Application.WorksheetFunction.VLookup(Luk, Sheets("Sheet1").Range("E:F"), 2, False)
If Err.Number = 0 Then
ActiveCell.Value = Sal
Else
ActiveCell = "Error"
End If
ActiveCell.Offset(1, 0).Select
'Loop
End Sub