Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Find Method; First letter

Good Day Group,

Can anyone help me with following; Trying to make a listbox filled with all
items that
have a selected letter, in textbox1, as its first letter. Below code seems
to list all items that have
the selected letter anywhere in its spelling.

Thanks and Brgds

CG Rosén

----------------------------------------------------------------------------
--------------
Dim s As String

ListBox1.Clear

With Worksheets(2).Range("B1:B231")
Set j = .Find(UserForm1.TextBox1.Text, LookIn:=xlValues,
SearchOrder:=xlByRows)

If Not j Is Nothing Then
firstAddress = j.Address
Do
r = j.Row
s = Sheets("c").Cells(r, 2)
ListBox1.AddItem s
Set j = .FindNext(j)
Loop While Not j Is Nothing And j.Address < firstAddress

End If

End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find Method; First letter

With Worksheets(2).Range("B1:B231")
Set j = .Find(Left(UserForm1.TextBox1.Text,1) & "*", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows)

--
Regards,
Tom Ogilvy

"CG Rosén" wrote in message
...
Good Day Group,

Can anyone help me with following; Trying to make a listbox filled with

all
items that
have a selected letter, in textbox1, as its first letter. Below code seems
to list all items that have
the selected letter anywhere in its spelling.

Thanks and Brgds

CG Rosén

--------------------------------------------------------------------------

--
--------------
Dim s As String

ListBox1.Clear

With Worksheets(2).Range("B1:B231")
Set j = .Find(UserForm1.TextBox1.Text, LookIn:=xlValues,
SearchOrder:=xlByRows)

If Not j Is Nothing Then
firstAddress = j.Address
Do
r = j.Row
s = Sheets("c").Cells(r, 2)
ListBox1.AddItem s
Set j = .FindNext(j)
Loop While Not j Is Nothing And j.Address < firstAddress

End If

End With




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
Using Find method wade Excel Programming 3 March 3rd 04 07:05 AM
find method? CG Rosén Excel Programming 2 November 12th 03 10:30 AM
Find method example Shinichi Excel Programming 3 August 22nd 03 10:39 PM
Help with the Find method Mike NG Excel Programming 3 August 4th 03 07:15 PM
The Find Method Dick Kusleika Excel Programming 3 July 16th 03 07:59 PM


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