bobkap

Board Regular
Joined
Nov 22, 2009
Messages
238
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) -
Item#DescriptionUOMCase Pack Dist Price MSRP

<tbody>
</tbody>
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,137
Office Version
  1. 365
Platform
  1. Windows
It means 'Dist Price' is not in row 1 of the 'Prices' worksheet. You probably have a trailing space or something in the cell.
 

bobkap

Board Regular
Joined
Nov 22, 2009
Messages
238
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
MEGA thanks! You nailed it!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,113,835
Messages
5,544,588
Members
410,621
Latest member
S Oberlander
Top