Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

we are facing issue to remove NA error while using iferror with Vloolkup in VBA worksheet Function?

0

Sheet1 have data column I - A,9,10 and 11 but in sheet4 have A,9,10 but not 11.

My question is if any code not listed in sheet4 then value should be "Bonnie"

Two integer R and R1

Statement is

Sheet1.cells(R1,10).value = application.worksheetfunction.IfError(Application.worksheetfunction.vlookup(Sheet1.cells(R,9),sheet4.range("B:C"),2,0),"bonnie")

but when execute the code then vb through error below:

Run -Time Error "1004":

Unable to get the Vlookup property of the WorksheetFunction class

But when application this function in excel like - =IFERROR(VLOOKUP(I2,'Raw Data'!$B$2:$C$57,2,0),"Bonnie") then result is fo 11 = Bonnie.

Please find attched the raw data where we ran this macro.

Answer
Discuss

Answers

0
Selected Answer

Change:

Application.WorksheetFunction.VLookup(Sheet1.Cells(R, 9), Sheet4.Range("B:C"), 2, 0)

To:

Application.VLookup(Sheet1.Cells(R, 9), Sheet4.Range("B:C"), 2, 0)

TheĀ WorksheetFunction is what needs to be removed.

Discuss
0

Thanks you very, its workin fine. Thanks

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login