Convert Index/match to vba

JannetteChristie

Board Regular
Joined
Dec 14, 2015
Messages
130
Office Version
  1. 365
Hello,

I am having trouble converting the following excel function to vba:
=INDEX('Product Selector'!F13:F18,MATCH(Specify!B10,'Product Selector'!A13:A18,0),1)

The vba code I have is as follows:
iRowNo = 10
For i = 1 To lr
x = Application.WorksheetFunction.Index(Sheets("Product Selector").Range("A13:A100") _
, Application.WorksheetFunction.Match(Sheets("Specify").Cells(iRowNo, 2), Sheets("Product Selector").Range("F3:F100"), 0), 1)

If Not (IsError(x)) Then
Worksheets("Specify").Cells(iRowNo, 4).Value = x
End If
iRowNo = iRowNo + 1
Next i

I keep getting a run-time error '1004'
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top