Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Combobox will not show list

Hi Everyone
I've got a userform with a combo box that will not show the list unless I press
the button to activate [ Private Sub UserForm1_Initialize() ] then everything is
ok.
My codes are below, can anyone figure out what I forgot ?
Thanking you in advance
Regards
John

Private Sub UserForm1_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub
'Exit Button

Private Sub CommandButton2_Click()
Unload UserForm1
End Sub

'Clear Button
Private Sub CommandButton3_Click()
Call UserForm1_Initialize
End Sub

'Date window
Private Sub TextBox1_enter()
Me.TextBox1.Value = Now
End Sub

'"OK" Button
Private Sub commandbutton1_Click()

Dim RowCount As Long
Sheets("sheet1").Activate
Range("A4").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox2.Value
ActiveCell.Offset(0, 6) = TextBox3.Value
ActiveCell.Offset(0, 5) = ComboBox1.Value

If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "Breakfast"
ElseIf OptionButton2 = True Then
ActiveCell.Offset(0, 1).Value = "Lunch"
ElseIf OptionButton3 = True Then
ActiveCell.Offset(0, 1).Value = "Dinner"
Else
ActiveCell.Offset(0, 1).Value = "Bedtime"

End If
If CheckBox1 = True Then
ActiveCell.Offset(0, 3).Value = "Yes"
Else
ActiveCell.Offset(0, 3).Value = "No"
End If
If CheckBox2 = True Then
ActiveCell.Offset(0, 4).Value = "Yes"
Else
ActiveCell.Offset(0, 4).Value = "No"
End If
Range("a4").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Combobox will not show list

Try this
Private Sub UserForm_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub


"John" wrote:

Hi Everyone
I've got a userform with a combo box that will not show the list unless I press
the button to activate [ Private Sub UserForm1_Initialize() ] then everything is
ok.
My codes are below, can anyone figure out what I forgot ?
Thanking you in advance
Regards
John

Private Sub UserForm1_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub
'Exit Button

Private Sub CommandButton2_Click()
Unload UserForm1
End Sub

'Clear Button
Private Sub CommandButton3_Click()
Call UserForm1_Initialize
End Sub

'Date window
Private Sub TextBox1_enter()
Me.TextBox1.Value = Now
End Sub

'"OK" Button
Private Sub commandbutton1_Click()

Dim RowCount As Long
Sheets("sheet1").Activate
Range("A4").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox2.Value
ActiveCell.Offset(0, 6) = TextBox3.Value
ActiveCell.Offset(0, 5) = ComboBox1.Value

If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "Breakfast"
ElseIf OptionButton2 = True Then
ActiveCell.Offset(0, 1).Value = "Lunch"
ElseIf OptionButton3 = True Then
ActiveCell.Offset(0, 1).Value = "Dinner"
Else
ActiveCell.Offset(0, 1).Value = "Bedtime"

End If
If CheckBox1 = True Then
ActiveCell.Offset(0, 3).Value = "Yes"
Else
ActiveCell.Offset(0, 3).Value = "No"
End If
If CheckBox2 = True Then
ActiveCell.Offset(0, 4).Value = "Yes"
Else
ActiveCell.Offset(0, 4).Value = "No"
End If
Range("a4").Select
End Sub

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Combobox will not show list

Hi Mike
Hours playing around trying to figure out what's wrong.
Went back to my books, check with the Internet.
I'm just starting to learn VBA and this one, is etched in my brain.
Thank you very much
Regards
John
"Mike" wrote in message
...
Try this
Private Sub UserForm_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub


"John" wrote:

Hi Everyone
I've got a userform with a combo box that will not show the list unless I
press
the button to activate [ Private Sub UserForm1_Initialize() ] then everything
is
ok.
My codes are below, can anyone figure out what I forgot ?
Thanking you in advance
Regards
John

Private Sub UserForm1_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub
'Exit Button

Private Sub CommandButton2_Click()
Unload UserForm1
End Sub

'Clear Button
Private Sub CommandButton3_Click()
Call UserForm1_Initialize
End Sub

'Date window
Private Sub TextBox1_enter()
Me.TextBox1.Value = Now
End Sub

'"OK" Button
Private Sub commandbutton1_Click()

Dim RowCount As Long
Sheets("sheet1").Activate
Range("A4").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox2.Value
ActiveCell.Offset(0, 6) = TextBox3.Value
ActiveCell.Offset(0, 5) = ComboBox1.Value

If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "Breakfast"
ElseIf OptionButton2 = True Then
ActiveCell.Offset(0, 1).Value = "Lunch"
ElseIf OptionButton3 = True Then
ActiveCell.Offset(0, 1).Value = "Dinner"
Else
ActiveCell.Offset(0, 1).Value = "Bedtime"

End If
If CheckBox1 = True Then
ActiveCell.Offset(0, 3).Value = "Yes"
Else
ActiveCell.Offset(0, 3).Value = "No"
End If
If CheckBox2 = True Then
ActiveCell.Offset(0, 4).Value = "Yes"
Else
ActiveCell.Offset(0, 4).Value = "No"
End If
Range("a4").Select
End Sub

.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Combobox will not show list

Just to add to Mike's response...

Mike changed the name of the procedure back to Userform_initialize. This is the
name of one of the standard events--you can't change it (well, and expect it to
work).



John wrote:

Hi Everyone
I've got a userform with a combo box that will not show the list unless I press
the button to activate [ Private Sub UserForm1_Initialize() ] then everything is
ok.
My codes are below, can anyone figure out what I forgot ?
Thanking you in advance
Regards
John

Private Sub UserForm1_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub
'Exit Button

Private Sub CommandButton2_Click()
Unload UserForm1
End Sub

'Clear Button
Private Sub CommandButton3_Click()
Call UserForm1_Initialize
End Sub

'Date window
Private Sub TextBox1_enter()
Me.TextBox1.Value = Now
End Sub

'"OK" Button
Private Sub commandbutton1_Click()

Dim RowCount As Long
Sheets("sheet1").Activate
Range("A4").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox2.Value
ActiveCell.Offset(0, 6) = TextBox3.Value
ActiveCell.Offset(0, 5) = ComboBox1.Value

If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "Breakfast"
ElseIf OptionButton2 = True Then
ActiveCell.Offset(0, 1).Value = "Lunch"
ElseIf OptionButton3 = True Then
ActiveCell.Offset(0, 1).Value = "Dinner"
Else
ActiveCell.Offset(0, 1).Value = "Bedtime"

End If
If CheckBox1 = True Then
ActiveCell.Offset(0, 3).Value = "Yes"
Else
ActiveCell.Offset(0, 3).Value = "No"
End If
If CheckBox2 = True Then
ActiveCell.Offset(0, 4).Value = "Yes"
Else
ActiveCell.Offset(0, 4).Value = "No"
End If
Range("a4").Select
End Sub


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Combobox will not show list

Hi Dave
Just learning the hardway.
Regards
John
"Dave Peterson" wrote in message
...
Just to add to Mike's response...

Mike changed the name of the procedure back to Userform_initialize. This is
the
name of one of the standard events--you can't change it (well, and expect it
to
work).



John wrote:

Hi Everyone
I've got a userform with a combo box that will not show the list unless I
press
the button to activate [ Private Sub UserForm1_Initialize() ] then everything
is
ok.
My codes are below, can anyone figure out what I forgot ?
Thanking you in advance
Regards
John

Private Sub UserForm1_Initialize()
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
CheckBox1 = False
CheckBox2 = False
With ComboBox1
.AddItem "Walking"
.AddItem "Running"
.AddItem "Tennis"
.AddItem "Bicycle"
.AddItem "Hockey"
End With
ComboBox1.Value = ""
End Sub
'Exit Button

Private Sub CommandButton2_Click()
Unload UserForm1
End Sub

'Clear Button
Private Sub CommandButton3_Click()
Call UserForm1_Initialize
End Sub

'Date window
Private Sub TextBox1_enter()
Me.TextBox1.Value = Now
End Sub

'"OK" Button
Private Sub commandbutton1_Click()

Dim RowCount As Long
Sheets("sheet1").Activate
Range("A4").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 2) = TextBox2.Value
ActiveCell.Offset(0, 6) = TextBox3.Value
ActiveCell.Offset(0, 5) = ComboBox1.Value

If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "Breakfast"
ElseIf OptionButton2 = True Then
ActiveCell.Offset(0, 1).Value = "Lunch"
ElseIf OptionButton3 = True Then
ActiveCell.Offset(0, 1).Value = "Dinner"
Else
ActiveCell.Offset(0, 1).Value = "Bedtime"

End If
If CheckBox1 = True Then
ActiveCell.Offset(0, 3).Value = "Yes"
Else
ActiveCell.Offset(0, 3).Value = "No"
End If
If CheckBox2 = True Then
ActiveCell.Offset(0, 4).Value = "Yes"
Else
ActiveCell.Offset(0, 4).Value = "No"
End If
Range("a4").Select
End Sub


--

Dave Peterson




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
[VBA] COMBOBOX SHOW WITH CONDITION Eddie_SP[_2_] Excel Programming 4 August 13th 09 09:29 PM
Show worksheet ComboBox DropDown list even when your not in it [email protected] Excel Programming 1 February 9th 07 06:28 PM
How does one show an intital value in the combobox susan Excel Programming 2 September 6th 06 09:48 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
ComboBox to show a range TimT Excel Programming 2 August 8th 05 07:58 PM


All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"