Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've got a small 'bug' in my userform but dunno how to fix it.
Further everything is working perfectly. When all the cells are filled and/or red background then I get th error message: Could not set ListIndex property. Invalid propert value. here's the code: Code ------------------- Private Sub UserForm_Initialize() Dim Cell As Range Dim Counter As Long Dim ListRange As Range Dim CListRange As Range Dim ListRangeValue() As Variant Dim CListRangeValue() As Variant Set CListRange = _ ActiveSheet.Range("Q9:Q106,Q113:Q162,Q169:Q183") Set ListRange = _ ActiveSheet.Range("C9:C106,C113:C162,C169:C183") ListRange.Style.IncludeNumber = True ReDim ListRangeValue(0 To ListRange.Cells.Count) For Each Cell In ListRange.Cells If Cell.Interior.ColorIndex < 3 Then Set Celv = Cells(Cell.Row, 16 + Weekscherm.ComboBox1.Value) If Celv = "" Then ListRangeValue(Counter) = Cell.Value Counter = Counter + 1 Me.ComboBox2.AddItem (Cell.Row) Me.ComboBox3.AddItem Cells(Cell.Row, 2) End If End If Next Cell Me.ComboBox1.List = ListRangeValue Me.ComboBox1.ListIndex = 0 Me.ComboBox2.ListIndex = 0 Me.ComboBox3.ListIndex = 0 End Sub Private Sub CommandButton1_Click() X = Me.ComboBox1.ListIndex If Me.TextBox1.Text = "" Or Me.TextBox1.Text = "" Then X = X - 1 Else X = Me.ComboBox1.ListIndex Set Cel = Cells(ComboBox2.Value, 16 + Weekscherm.ComboBox1.Value) Cel.Value = _ Me.TextBox1.Text End If Me.ComboBox1.ListIndex = IIf(X = 160, 0, X + 1) Me.ComboBox2.ListIndex = Me.ComboBox1.ListIndex Me.ComboBox3.ListIndex = Me.ComboBox1.ListIndex Me.TextBox1.Text = "" ComboBox1.AutoTab = True End Sub ------------------- I someone can help me fix this little bug I will be very please!! Thanks in Advance, Stif -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform | Excel Programming | |||
Userform inside another userform | Excel Programming | |||
Userform Help | Excel Programming | |||
UserForm | Excel Programming | |||
UserForm | Excel Programming |