Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone, I've got a exceldatabase where a user can fill in some data
in with a userform containing a combobox,textbox and command button, When Backgroundcolor of what the content is of the combobox it will not be displayed in the combobox, but the focus of the textbox won't work properly then. See code below. Thanks for the help! Code: -------------------- Private Sub UserForm_Initialize() Dim Cell As Range Dim Counter As Long Dim ListRange As Range Dim ListRangeValue() As Variant Set ListRange = _ ActiveSheet.Range("C9:C106,C113:C162,C169:C183") ReDim ListRangeValue(0 To ListRange.Cells.Count - 1) For Each Cell In ListRange.Cells If Cell.Interior.ColorIndex < 3 Then ListRangeValue(Counter) = Cell.Value Counter = Counter + 1 End If Next Cell Me.ComboBox1.List = ListRangeValue Me.ComboBox1.ListIndex = 0 End Sub -------------------- Code: -------------------- Private Sub CommandButton1_Click() If Me.TextBox1.Text = "" Then MsgBox "Vul getal in" Else X = Me.ComboBox1.ListIndex Me.ComboBox1.ListIndex = IIf(X = 160, 0, X + 1) If Weekscherm.ComboBox1.Value = "Week 1" Then Set Cel = Cells(9 + ComboBox1.ListIndex - 1, 17) Cel.Value = _Me.TextBox1.Text End If '.....so a if for every week of the year' Me.TextBox1.Text = "" ComboBox1.AutoTab = True End If End Sub -------------------- --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TextBox Focus | Excel Programming | |||
event which occurs when a TextBox receives focus | Excel Programming | |||
Which textbox have focus? | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming | |||
Cell Lost Focus | Excel Programming |