Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Find function for a listbox table in a userform

[Excel 2003]

I have a listbox in a Userform.

The list box displays a table of chemicals and their properties. It is a
multicolumn listbox and reads from a list called "Materials" which has approx
1000 chemicals in it.

I would like to add a textbox in which a user enters a chemical name and
code searches for that entry in the list, highlighting if it is found and
communicating if it isnt.

In my listbox, the chemicals are in the first column of the displayed table.

Additionally, I would like the user to be able to search by a desriptor
number (called a CAS number) which is in the second column in the listbox.
Each chemical has a unique descriptor number and is often used as alternative
way to search for a chemical.

It would be nice to have a "Find Next" button since sometimes the chemicals
are listed twice in the table under different chemical names, but with the
same CAS number.

Having the option of a wilcard * search option would be an added bonus. Any
other options would be great to have but a basic find ability would be the
priority.

Can anyone help?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find function for a listbox table in a userform


why not use a combobox rather than a text box. You can set the combobox
property RowSource to sheet1!A1:A15 (or equivalent) which is the list of
chemicals. The combo box give you the option of either typing in the
item or selecting the item from the list.

To find an item in the workshett us the following


Chemical = "Oxygen"
set c = sheets("Sheet1").Range("A1:A15").find(what:=Chemic al, _
lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find chemical : " & Chemical")
else
foundrow = c.row
end if


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=159041

Microsoft Office Help

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
fill userform textbox from userform listbox clik event GregJG[_21_] Excel Programming 3 December 7th 08 04:47 PM
Sum and Counta function in Listbox for UserForm Shazi Excel Programming 2 July 11th 08 10:54 PM
Find function Pivot Table dinadvani via OfficeKB.com Excel Discussion (Misc queries) 1 April 30th 08 02:58 PM
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM


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