bobkap

Board Regular
Joined
Nov 22, 2009
Messages
234
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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,111
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
234
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
MEGA thanks! You nailed it!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,453
Messages
5,528,871
Members
409,842
Latest member
mfernandezcean
Top