View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PBezucha PBezucha is offline
external usenet poster
 
Posts: 120
Default Case sensitive VBA Match

A recent thread showed the way how to do match with Exact function in Excel.
It reminded me of the need to improve my ancient VBA matches made clumsily by
sequel constraining the remainder of the (not very long) database or even
browsing it as a whole (first occurrence sufficient).

Unfortunately there is no WorksheetFunction.Exact €“ otherwise it would look
like this:

Function MatchRow(DBName As String, Sought As Variant) As Long
Dim DB As Range
With Worksheets(DBName)
Set DB = Range(.Range("A1"), .Range("A1").End(xlDown))
MatchRow = Application.WorksheetFunction.Match(True, _
Application.WorksheetFunction.Exact(Sought, DB), 0)
End With
End Function

Such a simple task should be very common, yet, and still I have not
succeeded in finding a smart DG solution. What are your better ways?

Sincerely
--
Petr Bezucha