LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default using worksheet functions INDEX and MATCH within a macro

dim res as variant
dim myVal as variant

res = application.match(cboProductSelect.Value, _
worksheets("sheet1").range("a1:a999"), 0)

if iserror(res) then
msgbox "No match found"
else
myval = worksheets("sheet1").range("b1:b999")(res)
end if

I wasn't sure what range1 and range2 were.



JurgenBrea wrote:

I would like to use a worksheet function in a macro. This is how I would do
it if I were entering it straight into a cell:

=INDEX(range1,MATCH(F1,range2,0))

Can anyone tell me how I would enter it into the macro?

The F1 would change to "cboProductSelect.Value", but other than that it
should be simple, right? *hopeful*

I found this reference, but haven't managed to get it working by trying to
follow the guidelines as my formula has too many differences:
http://msdn.microsoft.com/library/de...HV05205786.asp


--

Dave Peterson
 
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
INDEX and MATCH functions dannyboy8 Excel Worksheet Functions 2 November 25th 08 08:12 PM
Index and Match functions I think Jim Butler New Users to Excel 9 November 25th 08 02:34 AM
Using Index & Match functions to find data on separate worksheet. Andrew Duncan Excel Worksheet Functions 4 July 3rd 07 11:54 AM
How do I use the Match and Index functions to look up a value tha. Maclanders Excel Worksheet Functions 7 February 10th 05 08:31 PM
Using Index and Match functions to lookup data in another worksheet Chris Excel Programming 2 July 24th 03 09:28 PM


All times are GMT +1. The time now is 08:10 PM.

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"