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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

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,823
Messages
5,544,538
Members
410,619
Latest member
gregor222
Top