date match

austin350s10

Active Member
Joined
Jul 30, 2010
Messages
321
I am using the following script to search through column B and find the variable testdate:

Code:
lrow = Application.WorksheetFunction.Match(testdate, Range("B:B"), 0)

I keep getting errors though...

- column B contains of a list of data in date format

- the variable testdate is a string I think

Normally Match works fine for me but I think since I am trying to match dates it is giving me problems.

Is there a different/better way to do this? I just need to know the row or address of where the testdate matches with the date in column B.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
If testdate is a string and there are serial dates in column B, then you won't be able to match a string directly with a serial date. You would need to convert the srting to a serial date. There are different methods to do this. Here is one.
Code:
lrow = Application.Match([COLOR="Red"]CDate([/COLOR]testdate[COLOR="Red"])[/COLOR], Range("B:B"), 0)

This thread may also help
http://www.mrexcel.com/forum/showthread.php?t=68318
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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