LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default index and matching in userform!

thks Dave..!

the clng() does the trick and
now the code works like charm..!

thks & regds!

-via135



On Jan 30, 1:20 am, Dave Peterson wrote:
Are you sure that there's a match?

I'd do something like:

Dim res as variant
dim myVal as variant

res = application.match(txtpostcode.text,worksheets("she et99").range("c:c"),0)

if iserror(res) then
myval = "No Match Found"
else
myval = worksheets("sheet99").range("b:B").cells(res,1).va lue
end if

txtLocation.text = myval

======
And by specifying the worksheet, you'll make sure that the code is looking at
the worksheet you want.

===
And if the data in column C is numeric (not Text), then maybe:

res = application.match(clng(txtpostcode.text), _
worksheets("sheet99").range("c:c"),0)

The value from the textbox will be text. clng() will convert it to a whole
number (if it's numeric).





via135 wrote:

hi Bob!


thks for the reply..
i am getting #NA error..


can u explain me the following a bit more?


You might want to qualify the ranges with the worksheet object
Worksheets("Sheet1").Range(...


thks n regds!


-via135


On Jan 28, 3:51 pm, "Bob Phillips" wrote:
txtLOcation.Text =
Application.Index(Range("B:B"),Application.Match(t xtPostcode.Text,Range("C:**C
"),0))


where column B is the location column, C is the postcode.


You might want to qualify the ranges with the worksheet object


Worksheets("Sheet1").Range(...


--
HTH


Bob Phillips


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"via135" wrote in ooglegroups.com...


hi all!


i am having a userform with lables name, location..
but i am having a list of locations and the corresponding
postal codes in a separate worksheet


is it possible while i am entering the postal code in the location
textbox, the
corresponding location would be picked up in the main data worksheet?


regds!


via135- Hide quoted text -- Show quoted text -


--

Dave Peterson- Hide quoted text -

- Show quoted text -





 
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
Matching two columns and their data [email protected] Excel Worksheet Functions 2 March 6th 06 08:17 PM
Index/ Lookup formulas and fuzzy matching JaB Excel Worksheet Functions 0 November 10th 05 10:04 AM
Match and Index jdeumer Excel Worksheet Functions 0 July 14th 05 10:23 AM
Index & Matching Functions Erik Sauceda via OfficeKB.com Excel Discussion (Misc queries) 5 June 13th 05 11:46 PM
Formula for Searching & matching two values in excel Chris Excel Discussion (Misc queries) 1 January 7th 05 04:34 PM


All times are GMT +1. The time now is 11:27 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"