LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Need Help Modifying Code Please

I have a worksheet LOADED w/ info; I have created a UserForm with a textbox,
commadButton and a listbox. When i type a criteria in the textbox in the
information appears in the list box. After a good while I notice more the one
occurrence of said criteria how do I modify the code below to include the
second occurrence in the list box?

Sub CommandButton1_Click()
Dim rng As Range
Dim Ary(6) As String
Dim i As Single

If Me.TextBox1.Value = "" Then
MsgBox "You Must Enter A Number", _
vbExclamation, "Error"
Exit Sub
End If
Set rng = Worksheets(1).Range("A2:A65536").Find _
(Me.TextBox1.Value, LookIn:=xlValues)
If Not rng Is Nothing Then
rng.Select
ListBox1.ColumnCount = 6

For i = 0 To 6
Ary(0) = i
Next i

Ary(0) = ActiveCell.Value
Ary(1) = ActiveCell.Offset(0, 1).Value
Ary(2) = ActiveCell.Offset(0, 2).Value
Ary(3) = ActiveCell.Offset(0, 3).Value
Ary(4) = ActiveCell.Offset(0, 4).Value
Ary(5) = ActiveCell.Offset(0, 5).Value
ListBox1.Column() = Ary
Else
MsgBox Me.TextBox1.Value & _
" Does Not Exist", vbCritical, "Error"
Exit Sub
End If
Me.TextBox1.Value = ""
End Sub

 
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
Looking for Help in modifying a code [email protected] Excel Programming 6 January 31st 08 01:57 AM
modifying code in run time alfaista Excel Programming 2 November 18th 04 10:09 PM
Help is needed for modifying this code. J_J Excel Programming 2 October 10th 04 09:59 PM
Need Help Modifying Code JStone0218 Excel Programming 2 January 19th 04 10:27 AM
Help modifying code BruceJ[_2_] Excel Programming 1 December 10th 03 12:52 AM


All times are GMT +1. The time now is 03:25 AM.

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"