LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default List Box Match

Hi Tom

I did paste it and I tend not to alter anything until I can get it working
and comma's and full stops are all part of Excel and I would never know if
one was right or wrong. Anyway got it working and doing just what I want -
you guys amaze me sometimes with your knowledge how do you remember it all ???
--
Many thanks

hazel


"Tom Ogilvy" wrote:

cells(rngFound,row,6)) has a typo

cells(rngFound.row,6))

The code was a suggested approach. It wasn't intended to be a paste in
solution. It hasn't been tested.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote:

Maybe something like this:

Private Sub Cmd1_Click()
Dim rngToSearch As Range
Dim rngFound As Range
Set rngToSearch = ActiveSheet.Columns("F")
Set rngFound = rngToSearch.Find(What:=Tb1.Value, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry " & Tb1.Value & " was not found."
Else
With Lb1
for i = 0 to .listcount - 1
if .list(i,4) = tb1.value then
lb1.ListIndex = i
for each cell in Range(cells(rngFound.row,1), _
cells(rngFound,row,6)) '<== change the 6 to reflect number of
columns
s = cell.Value & ","
Next
TB2.value = Left(s,len(s)-1)
exit for
end if
Next
rngFound.Select
End With
End If


End Sub


--
Regards,
Tom Ogilvy


"Hazel" wrote:

Hi All

I have adapted the code below from something I found in this forum

Private Sub Cmd1_Click()
Dim rngToSearch As Range
Dim rngFound As Range
Set rngToSearch = ActiveSheet.Columns("F")
Set rngFound = rngToSearch.Find(What:=Tb1.Value, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry " & Tb1.Value & " was not found."
Else
rngFound.Select

End If

End Sub

It works OK and finds the number I'm searching for in Column "F" what I
would like to happen is that on finding the correct selection it will also
highlight the row in the list box "Lb1" which also contains the same number
in Column 5 in the list box ,it would then display the information in a new
TextBox "Tb2" -- I would then not have to keep closing the UserForm to read
all the info. Hope I have expained it all properly.
--
Many thanks

hazel



 
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
Find a match in a list jlclyde Excel Discussion (Misc queries) 1 February 28th 08 07:18 PM
match list Jai Excel Discussion (Misc queries) 4 June 27th 07 08:44 PM
match and list Anthony Excel Worksheet Functions 1 March 24th 07 12:07 PM
Product list to match price list badgrandntl Excel Discussion (Misc queries) 13 February 2nd 06 02:28 AM
searching a list box for a filename match...and highlighting the match suee[_4_] Excel Programming 1 April 13th 04 02:56 AM


All times are GMT +1. The time now is 07:08 AM.

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"