Hi,
How can I adapt the code so that it checks if the cells in range D are empty before it runs the code in each cell?
If the cell is not empty the code should skip to the next cell in the column.
Dim myCell As Range
Dim rngResult As Variant
For Each myCell In Sheets("Kalkyl").Range("C8", Range("C" & Rows.Count).End(xlUp))
Debug.Print myCell.Address
On Error Resume Next
rngResult = Application.WorksheetFunction.VLookup(myCell.Value, Sheets("APL").Range("B:G"), 2, 0)
If Err.Number <> 0 Then
Cells(myCell.Row, "D").Value = "#VALUE"
On Error GoTo 0
Else
Cells(myCell.Row, "D").Value = rngResult
End If
Next myCell
Bookmarks