Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

Can noone help me ?????????? :

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Little bug in my userform

You can't set the listindex if there is nothing in the list

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

If combobox1.Listcount 0 then Me.ComboBox1.ListIndex = 0
If combobox2.Listcount 0 then Me.ComboBox2.ListIndex = 0
If combobox3.Listcount 0 then Me.ComboBox3.ListIndex = 0

End Sub



--
Regards,
Tom Ogilvy
"Stift " wrote in message
...
Can noone help me ?????????? :(


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

Sorry Tom but that's not exaclty what I mean.

I don't no if it's possible.but the check must be in d
Commandbutton.

Something like

Code
-------------------

If Counter=0 Then
MsgBox "All data has been filled"
Unload Me
menu.show
Else

//rest of code

End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

Anybody who can help me ,please do !!! I really must get this fixxed. :

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

Is there nobody who can help me :( :( ????????

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

:( :( :

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little bug in my userform

I still didn't solve this problem.
The solution that was given works.But it must be fixed from th
commandbutton instead of the userform open

--
Message posted from http://www.ExcelForum.com

Reply
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
Userform nath Excel Programming 1 May 25th 04 03:06 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM
Userform Help Pete[_13_] Excel Programming 1 November 14th 03 10:03 PM
UserForm Gabriel[_2_] Excel Programming 0 July 28th 03 04:40 PM
UserForm Gabriel[_2_] Excel Programming 0 July 28th 03 04:40 PM


All times are GMT +1. The time now is 09:39 PM.

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"