Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default MATCH with VBA - Can anyone get it to work?? (download my test file )

Instead of numerous messages back and forth - maybe someone can help
me by downloading my small test file and editing one of the sample VBA
Sub's and Functions I placed in there.

Here is the file:

www.infocellar.com/test1.zip

I tried numerous code snippets from messages in here as to how to use
the Match function within Visual Basic for Excel. None have worked.

My test1.xls files is simple - two sheets. The first sheet, "CLEC" is
the one I want to find my matches in. The second sheet "Customer" has
the Match function in it. In the Customer sheet, Colum A is the
search terms, Columb B is the same terms with an * in front and after
the text so that it will work with partila matches, and Column C shows
the results of the Match function - which is working fine.

But the cell, D4 is where I am trying to use VBA to insert a result
from a Match subroutine or embedded custom function.

See if you can play around with it and email me the working test1.xls
- thats a heap !!! My email is:


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default MATCH with VBA - Can anyone get it to work?? (download my test file )

I don't see any evidence of a UDF that could work in your workbook since the
UDFs you have either take no inputs or a double as an input (and the
worksheet contains strings).

Anyway this UDF:

Function JimMatch(Item As Variant, Rg As Range) As Variant
JimMatch = Application.Match(Item, Rg, False)
End Function

used like this in the worksheet:

=JimMatch(B7,CLEC!A1:A9)

seems to work.

--
Jim Rech
Excel MVP


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default MATCH with VBA - Can anyone get it to work?? (download my test file )

Keith < wrote in message . ..
Instead of numerous messages back and forth - maybe someone can help
me by downloading my small test file and editing one of the sample VBA
Sub's and Functions I placed in there.

Here is the file:

www.infocellar.com/test1.zip

I tried numerous code snippets from messages in here as to how to use
the Match function within Visual Basic for Excel. None have worked.

My test1.xls files is simple - two sheets. The first sheet, "CLEC" is
the one I want to find my matches in. The second sheet "Customer" has
the Match function in it. In the Customer sheet, Colum A is the
search terms, Columb B is the same terms with an * in front and after
the text so that it will work with partila matches, and Column C shows
the results of the Match function - which is working fine.

But the cell, D4 is where I am trying to use VBA to insert a result
from a Match subroutine or embedded custom function.

See if you can play around with it and email me the working test1.xls
- thats a heap !!! My email is:



Sub Test1()
Sheets("Customer").Select
Range("d1") = "VBA match"
For d = 2 To Range(Range("a1"), Range("a1").End(xlDown)).Count
Match1 = "no match"
On Error Resume Next
Match1 = Application.WorksheetFunction.Match(Range("b" & d),
Worksheets("CLEC").Range("a1:a9"), 0)
Range("d" & d) = Match1
Next

End Sub

I hope that's what you're looking for.
Reply
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
download a template excel Calendar into a work sheet? Carl R[_2_] Excel Discussion (Misc queries) 1 January 26th 10 10:56 PM
download or paste a calendar in a work sheet? Carl R[_2_] Excel Discussion (Misc queries) 1 January 25th 10 04:00 PM
previous download doesn't work willem Excel Discussion (Misc queries) 0 August 21st 08 02:26 PM
compare and match test LITTLE PETE Excel Worksheet Functions 1 November 9th 07 03:24 PM
Tried to download SP3 no disc now Excel does not work Taipan Excel Discussion (Misc queries) 2 July 23rd 05 08:59 PM


All times are GMT +1. The time now is 12:28 AM.

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

About Us

"It's about Microsoft Excel"