This might help. I am trying to fill a listbox with 3 columns based on a one find item. so i look at all "PR0008" and
store the 3 columns in a array to later display in a listbox. Here is
the code so far. It does not store the "DEPT" but instead the count.Private Sub UserForm_Initialize()
Dim lb As msforms.ListBox
Dim rcArray() As String
Dim Dept As Integer
With Worksheets("Gages").Range("I2:I25")
Set D = .Find("PR0010", LookIn:=xlValues)
firstaddress = D.Address
Set D = .FindNext(D)
While D.Address <> firstaddress
Dept = Dept + 1
MsgBox Dept
MsgBox
D
ReDim Preserve rcArray(1 To Dept)
rcArray(D) = D
Set D = .FindNext(D)
Wend
End With
'Place the array in the listbox
Set lb = Me.ListBox1
With lb
.ColumnCount = 1
.ColumnWidths = "50"
.List = rcArray
End With
End Sub
________________________________
From: "1z@compuserve.com" <1z@compuserve.com>
To: ExcelVBA@yahoogroups.com
Sent: Wednesday, February 22, 2012 12:51 PM
Subject: Re: [ExcelVBA] Re: LISTBOX
Hi,
This looks incomplete... would you like to resend???
Lisa
Sent: Wed, Feb 22, 2012 6:45 pm
Subject: [ExcelVBA] Re: LISTBOX
Use the Data Validation, select list & then wherever the values are stored in
our workbook
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar