Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA Match?


Hi,

If i had an input box where whatever the user put in would be equal to
a string, lets call that string d, would it be possible to write some
code which said match string d to the names which are in the range of
D1:ED1 baring in mind that in the range D1:ED1 is a list of staff names
so it should be possible to match string d to one of those names.

Could anyone provide code?


--
alymcmorland
------------------------------------------------------------------------
alymcmorland's Profile: http://www.excelforum.com/member.php...o&userid=27652
View this thread: http://www.excelforum.com/showthread...hreadid=482825

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can VBA Match?

option explicit
sub testme
dim res as variant
dim myRng as range
dim d as string

set myrng = worksheets("Sheet1").range("d1:Ed1")

d = inputbox(Prompt:="type something")

if trim(d) = "" then
exit sub 'user didn't type anything.
end if

res = application.match(d,myrng,0)

if iserror(res) then
msgbox "Not a match. The board goes back
else
msgbox "Found a match!
end if

end sub


alymcmorland wrote:

Hi,

If i had an input box where whatever the user put in would be equal to
a string, lets call that string d, would it be possible to write some
code which said match string d to the names which are in the range of
D1:ED1 baring in mind that in the range D1:ED1 is a list of staff names
so it should be possible to match string d to one of those names.

Could anyone provide code?

--
alymcmorland
------------------------------------------------------------------------
alymcmorland's Profile: http://www.excelforum.com/member.php...o&userid=27652
View this thread: http://www.excelforum.com/showthread...hreadid=482825


--

Dave Peterson
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
Match 2 Columns, Return 3rd, Differing Match Types Matt.Russett Excel Worksheet Functions 3 May 11th 10 10:45 AM
Lookup Formula: Return 1st match, then 2nd match, then 3rd match Scott Excel Discussion (Misc queries) 4 December 11th 09 05:50 AM
index(match) Wind Uplift Calculations (match four conditions) JMeier Excel Worksheet Functions 8 August 1st 08 01:45 AM
MATCH Multiple Criteria & Return Previous / Penultimate Match Sam via OfficeKB.com Excel Worksheet Functions 27 October 6th 07 01:39 AM
Lookup? Match? pulling rows from one spreadsheet to match a text f cjax Excel Worksheet Functions 3 July 21st 06 02:51 PM


All times are GMT +1. The time now is 05:30 PM.

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"