App Match Error 2042

bobkap

Active Member
Joined
Nov 22, 2009
Messages
323
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I have the following code in my macro:
itemnocol = Application.Match("Item#", Worksheets("Prices").Range("1:1"), 0)
banana = Application.Match("Dist Price", Worksheets("Prices").Range("1:1"), 0)

I get the correct answer for "itemnocol", but using the exact same wording, I get an "Error 2042" for "banana". I've stared at this for a very long time and I just cannot see what I am not getting the correct response for banana.

This is what makes up my top row (1:1) -
[TABLE="width: 846"]
<tbody>[TR]
[TD]Item#[/TD]
[TD]Description[/TD]
[TD]UOM[/TD]
[TD]Case Pack [/TD]
[TD]Dist Price [/TD]
[TD]MSRP[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
It means 'Dist Price' is not in row 1 of the 'Prices' worksheet. You probably have a trailing space or something in the cell.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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