Error using the MATCH worksheet function

rdionne

New Member
Joined
Feb 21, 2002
Messages
47
I get an error when I try to use MATCH from the immediate window:

?Application.WorksheetFunction.Match(0.2,A1:A10,1) A1:A10 contains a sequential range of numbers from -.2 to 0.5 . I get a compile error "Expected list separator or )". From Excel help, this seems to be the correct syntax. What am I missing?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
It seems that the help examples only work on a spreadsheet, not from VBA. VBA requires a range.This works:

?Application.WorksheetFunction.Match(0.2,Worksheets("Sheet1").range("A1:A10"),1)
5
 
Upvote 0
Change that to

Application.Match(0.2,Range("A1:A10"),1)

It's a little more reliable than using the WorksheetFunction
 
Upvote 0
You can also fix the problem by changing your quotations to brackets:

Application.Match(0.2, [A1:B10], 0)
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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