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

I'm fairly new to VBA, but learning fast! Okay, so here's the
problem...

I've got Form1 with 2 optionbuttons, 2 comboboxes, and a
commandbutton. The optionbuttons tell what list will show in the
comboboxes, then the value chosen in the combobox will filter the main
data when the commandbutton is clicked. I'm having problems getting
the value of the comboboxes to show up, so I broke it down as simple
as I could.

Dim CVal As Variant

CVal = Form1.CptyBox.Value
MsgBox CVal

What I'm getting is a blank message box to appear (it should have a
value in it). Am I not referring to the combobox properly? Any ideas
are appreciated.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox Value

on a userform it should work...
drop two option buttons, one con=mbobox and a command
button onto a new userform, leave the names with the
default. add the following code

Private Sub CommandButton1_Click()
MsgBox UserForm1.ComboBox1.Value
End Sub

Private Sub OptionButton1_Click()
With ComboBox1
.Clear
.AddItem "A"
.AddItem "B"
End With
End Sub

Private Sub OptionButton2_Click()
With ComboBox1
.Clear
.AddItem "X"
.AddItem "Y"
End With
End Sub



hth
Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I'm fairly new to VBA, but learning fast! Okay, so

here's the
problem...

I've got Form1 with 2 optionbuttons, 2 comboboxes, and a
commandbutton. The optionbuttons tell what list will

show in the
comboboxes, then the value chosen in the combobox will

filter the main
data when the commandbutton is clicked. I'm having

problems getting
the value of the comboboxes to show up, so I broke it

down as simple
as I could.

Dim CVal As Variant

CVal = Form1.CptyBox.Value
MsgBox CVal

What I'm getting is a blank message box to appear (it

should have a
value in it). Am I not referring to the combobox

properly? Any ideas
are appreciated.

Thanks.
.

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
combobox value flow23 Excel Discussion (Misc queries) 0 April 26th 06 12:21 PM
Combobox nc Excel Discussion (Misc queries) 1 September 28th 05 02:11 PM
Combobox David Fixemer Excel Programming 1 February 24th 04 05:03 AM
combobox Nicky* Excel Programming 3 July 28th 03 09:26 PM


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