I have this Excel VBA macro which runs really well
Sub PCMSLookupTool()
Dim LastRow As Long
With Sheets("Lookup Tools") '<-set this worksheet reference properly
LastRow = .Range("A" & Cells.Rows.Count).End(xlUp).Row
With .Range("J10:J" & LastRow)
.Formula = "=VLOOKUP(A10, 'PCMS-dump'!A:B, 2, FALSE)"
.Cells = .Value2
End With
End With
End Sub
But I need to make it so if it does not find a value (returns #N/A) to run another vlookup ("=VLOOKUP(A10, 'Imported in PCMS'!A:C, 3, FALSE)"
How would I go about to do this?
Aucun commentaire:
Enregistrer un commentaire