asked on
Dim LastRowG As Double, dealer As Variant, DealerNumber As Variant, f As Double
With Balance.Sheets("Líquidas")
LastRowG = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For f = 7 To LastRowG
dealer = Balance.Sheets("Líquidas").Range("C" & f).Value
'Checking when the column which is being compared is not empty
If Not IsEmpty(dealer) Then
'Checking when the column which is beincompared with is not empty
If Not (Application.WorksheetFunction.IsNA(Application.WorksheetFunction.VLookup(dealer, RSC.Sheets("OSB").Range("A2:G1000"), 2, False))) Then
DealerNumber = Application.WorksheetFunction.VLookup(dealer, RSC.Sheets("OSB").Range("A2:G1000"), 2, False)
Else
DealerNumber = 0
End If
Else
DealerNumber = 0
End If
Balance.Sheets("Líquidas").Range("AH" & f).Value = DealerNumber
Next f