trailbarge
New Member
- Joined
- Sep 24, 2008
- Messages
- 4
I have a list of frames with engineering data on a worksheet. I am populating a combo box with the frame names (I'll be using the index from this combo box for other data lookup once I get this ironed out). The commented out stuff in the initialize code you see below works.
As I will be populating several combo boxes from several lists, I'd like to have one subroutine for the looping and pass to it the form and combo box to be populated and also the worksheet from which to grab the data.
Something like:
GetFrameList(cboFramelist, FRAMEDATA)
and the sub to look like
cboFramelist.additem Worksheets(FRAMEDATA).Cells... blahblahblah
Is there any hope or will I be typing do loops until the cows come home?
Thanks, all
Paul
====================================================
Sub UserForm_Initialize()
'Dim i As Integer
'i = 4
'Do While Worksheets("FRAMEDATA").Cells(i, 1) <> ""
' UserForm1.CboFramelist.AddItem Worksheets("FRAMEDATA").Cells(i, 1)
' i = i + 1
'Loop
GetFrameList ()
End Sub
Sub GetFrameList()
Dim i As Integer
i = 4
Do While Worksheets("FRAMEDATA").Cells(i, 1) <> ""
UserForm1.CboFramelist.AddItem Worksheets("FRAMEDATA").Cells(i, 1)
i = i + 1
Loop
End Sub
As I will be populating several combo boxes from several lists, I'd like to have one subroutine for the looping and pass to it the form and combo box to be populated and also the worksheet from which to grab the data.
Something like:
GetFrameList(cboFramelist, FRAMEDATA)
and the sub to look like
cboFramelist.additem Worksheets(FRAMEDATA).Cells... blahblahblah
Is there any hope or will I be typing do loops until the cows come home?
Thanks, all
Paul
====================================================
Sub UserForm_Initialize()
'Dim i As Integer
'i = 4
'Do While Worksheets("FRAMEDATA").Cells(i, 1) <> ""
' UserForm1.CboFramelist.AddItem Worksheets("FRAMEDATA").Cells(i, 1)
' i = i + 1
'Loop
GetFrameList ()
End Sub
Sub GetFrameList()
Dim i As Integer
i = 4
Do While Worksheets("FRAMEDATA").Cells(i, 1) <> ""
UserForm1.CboFramelist.AddItem Worksheets("FRAMEDATA").Cells(i, 1)
i = i + 1
Loop
End Sub