Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Another ComboBox Issue

I'm having another ComboBox issue. The good thing about a combobox is
that the user has the ability to enter their own answer, when the ones
presented do not match what they need, which is why I'm using one.
My ComboBox has 4 options presented to the user. The ComboBox.Value of
the first option is 0, and the next is 1 etc. Now, what would be the
value of the ComboBox if the user enters in their own info. I'm using
the ComboBox.Value to determine the contents of one cell, and can get it
to work for the four options I give them, but if they put in their own
stuff, I can't get that info to populate into the cell. My code is as
follows:

Private Sub Contract1_Enter()
ComboBox1.DropDown
ComboBox1.AddItem "Option 1"
ComboBox1.AddItem "Option 2"
ComboBox1.AddItem "Option 3"
ComboBox1.AddItem "Option 4"
'Use drop-down list
ComboBox1.Style = fmStyleDropDownCombo
'Combo box values are ListIndex values
ComboBox1.BoundColumn = 0
'Set combo box to first entry
ComboBox1.ListIndex = 0

End Sub

Then in a command button I have this:
If Contract1.Value = 0 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 0"
If Contract1.Value = 1 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 1"
If Contract1.Value = 2 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 2"
If Contract1.Value = 3 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 3"

Any ideas?



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Another ComboBox Issue

change
ComboBox1.BoundColumn = 0

to
ComboBox1.BoundColumn = 1

and in your button click event just do
ActiveWorkbook.Worksheets _
("Sheet1").Range("E20") =Combobox1.Value


It is a bit unclear whether you combobox is named Combobox1 or Contract1.

I assumed Combobox1.

--
Regards,
Tom Ogilvy


"Darrin Henry" wrote in message
...
I'm having another ComboBox issue. The good thing about a combobox is
that the user has the ability to enter their own answer, when the ones
presented do not match what they need, which is why I'm using one.
My ComboBox has 4 options presented to the user. The ComboBox.Value of
the first option is 0, and the next is 1 etc. Now, what would be the
value of the ComboBox if the user enters in their own info. I'm using
the ComboBox.Value to determine the contents of one cell, and can get it
to work for the four options I give them, but if they put in their own
stuff, I can't get that info to populate into the cell. My code is as
follows:

Private Sub Contract1_Enter()
ComboBox1.DropDown
ComboBox1.AddItem "Option 1"
ComboBox1.AddItem "Option 2"
ComboBox1.AddItem "Option 3"
ComboBox1.AddItem "Option 4"
'Use drop-down list
ComboBox1.Style = fmStyleDropDownCombo
'Combo box values are ListIndex values
ComboBox1.BoundColumn = 0
'Set combo box to first entry
ComboBox1.ListIndex = 0

End Sub

Then in a command button I have this:
If Contract1.Value = 0 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 0"
If Contract1.Value = 1 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 1"
If Contract1.Value = 2 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 2"
If Contract1.Value = 3 Then ActiveWorkbook.Worksheets
_("Sheet1").Range("E20") = "Option 3"

Any ideas?



*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Another ComboBox Issue

Thanks Tom. It is actually named Contract1, but when pasting my code, I
tried to change them all to the generic ComboBox1. I'll try it on
Monday, when I'm back at work.


*** Sent via Developersdex http://www.developersdex.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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Another ComboBox Issue Darrin Henry[_2_] Excel Programming 1 April 16th 05 09:18 AM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
Populating combobox from another combobox David Goodall Excel Programming 1 September 12th 04 03:42 PM
Combobox Scott Excel Programming 2 July 23rd 03 02:49 PM


All times are GMT +1. The time now is 08:45 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"