Type Mismatch Error

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am receiving a "Type mismatch" error with this line of code (in red), and I am looking for some guidance as to it's cause. The line is intended to return the line number holding the value (usd) in column B of worksheet ws_dest.

Rich (BB code):
        With ws_dest
            drow = Application.WorksheetFunction.index(usd, .Range("B:B"), 0)
        End With

drow is defined as long.
usd is a variable holding a serial date
ws_dest is a legit worksheet
The values in column B are dates(?) formatted as ddd dd-mmm. When I click on a cell in column B, the formula bar displays 1/23/2018 (as an example), so assume it is also a date.
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Without recreating your workbook, a couple ideas that come to mind are:

Try adding a "." in front of "Application"

Try removing "Application" altogether (but leave the "." in front of WorksheetFunction)
 
Upvote 0
Hi.

Try to use the match function

Code:
[COLOR=#ff0000]Application.WorksheetFunction.Match(usd, .Range("B:B"), 0)[/COLOR]
instead
 
Last edited:
Upvote 0
Thank you both for offering up your solutions.
It turns out, I was using the wrong command ... I wanted MATCH when I thought INDEX was what I needed.
louiseH, you set me on the proper course!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

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