I've only started using VBa and I keep getting an Expected: end of statement error. I'm not sure what the issue is. I need the vba to loop an if statement with a vlookup and an iferror. I can't set the range because the list will be dynamic. The more I try to fix the code myself the more messy it gets. I've scoured the internet for help.
Any and all help would be appreciated.
The formula is running on the MasterData tab and pulling from the DataDrop tab.
Sub COAB()
Dim i As Range
Set i = Sheets("MasterData").Range("D2")
Dim i2 As Range
Dim i3 As Range
Set i2 = Sheets("MasterData").Range("W2")
Set i3 = Sheets("MasterData").Range("X2")
Dim MasterData As Worksheet
Dim DataDrop As Worksheet
Set MasterData = ThisWorkbook.Sheets("MasterData")
Set DataDrop = ThisWorkbook.Sheets("DataDrop")
Do Until IsEmpty(i)
i2 = "=IFERROR(IF(VLOOKUP(" & MasterData.Range("D2").Address(0, 0) & ","
& DataDrop.Range("A:C") & ",3,FALSE)" <> "NULL" & ", & ""Charged Off"" & ","
& "Active "),"& Active")"
i3 = "=IFERROR(VLOOKUP(RC[-20],'DataDrop'!A:C,2,FALSE),0)"
Set i = i.Offset(1)
Set i2 = i2.Offset(1, 0)
Set i3 = i3.Offset(1, 0)
Loop
End Sub
Aucun commentaire:
Enregistrer un commentaire