View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
natanz[_2_] natanz[_2_] is offline
external usenet poster
 
Posts: 40
Default ranges in combobox

i am trying to use a range to fill a series of comboboxes. I am using
a for loop to iterate through the comboboxes, and set the range as the
list in the combobox. the problem is that i want to update to the
range in response to a property specific to the combobox (.tag).

here's my code

Public Sub init_cboxes(ByVal LotLoc As String, ByVal MyForm As Object)
Dim ctl As Control

WT = Range("W_T")
DT = Range("D_T")

MyForm.Caption = LotLoc & ActiveCell.Value
For Each ctl In MyForm.Controls
If TypeName(ctl) = "ComboBox" Then
RangeFill (ctl.Tag)
ctl.List = WT
ctl.ListIndex = 0
End If
Next ctl

MyForm.TextBox1.Value = 0
End Sub

and here's my code for the sub Rangefill:

Public Sub RangeFill(wtype As Integer)
Dim i As Integer
For i = 1 To 5
Range("w_t").Cells(2 + (2 * i)) = Price(wtype, i + 2)
Next
End Sub

what i think is happening is that the variable WT is not being updated,
even while the cells of the range are. I tried moving the assignment
line WT = Range("W_T") after the line RangeFill(ctl.tag) but that
didn't work. Any Advice.