LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Worksheet.Match the best way to go?

I'm trying to determine if a given date exists within a list of dates. The
best my limited skills could produce was to use the Match function and check
for an error if the number wasn't in the list. Is there a better way? What
I have looks like this:

Sub Foo_TestMatch()

Dim wks As Worksheet
Dim rng As Range
Dim x As Long, y As Double

Set wks = ActiveSheet
Set rng = wks.Range("A1:A10")
x = 12
Err.Clear
On Error Resume Next
y = Application.WorksheetFunction.Match(x, rng, 0)
If Err.Number < 0 Then MsgBox Err.Number
Err.Clear
On Error GoTo 0

End Sub

(To test this, I was just using numbers, so that's why nothing is a date.)

Ed


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete value on worksheet 2 that match values on worksheet 1 np Excel Discussion (Misc queries) 0 December 10th 09 06:02 PM
Match worksheet Bob F[_2_] Excel Discussion (Misc queries) 3 May 9th 09 06:02 PM
Look up and match Vendor name in one cell of worksheet from list ofmultiple Vendor names in column of other worksheet insitedge Excel Worksheet Functions 2 March 11th 08 11:36 PM
Match WORKSHEET Aslam Excel Worksheet Functions 1 September 2nd 07 01:10 PM
Match 2 worksheet mohsin Excel Worksheet Functions 1 August 12th 06 01:46 PM


All times are GMT +1. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"