How to fill combobox with values ?

audrey

Active Member
Joined
Jul 30, 2008
Messages
491
Hello,

1. How can I fill the combobox with values ? (EDIT: I did it from Properties)
2. and secondly if chosen value b (among a,b and c) what is the enxt steps to write the macro ?

Thank you
 
Last edited:

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
2. and secondly if chosen value b (among a,b and c) what is the enxt steps to write the macro ?

What do you want the macro to do?

Note that an easy way to trigger a macro with a list selection is to use a Change event coupled with a Data Validation drop-down box, as opposed to a ComboBox.
 

audrey

Active Member
Joined
Jul 30, 2008
Messages
491
well according to the value chosen inside the combobox, few cells will be hidden or revealed. I know the macro hides and unhides the cells, but I forgottten how to choose the value in combobox.
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536

ADVERTISEMENT

Here's one way:

Code:
Private Sub ComboBox1_Change()
    MsgBox ComboBox1.Value
End Sub

The other way would be

MsgBox [A1].Value

If A1 is your linked cell.
 

audrey

Active Member
Joined
Jul 30, 2008
Messages
491
Private Sub ComboBox1_Change()
Select Case ComboBox1.Value
Case "Date"
Call Macro12
Case "Name"
Call Macro13
Case "Type"
Call Macro14
End Select

End Sub

why this one not working ???
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
What happens?

What does this do for you:

<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> ComboBox1_Change()<br>    <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> ComboBox1.Value<br>        <SPAN style="color:#00007F">Case</SPAN> "Date"<br>            MsgBox "Date"<br>            <SPAN style="color:#007F00">'Call Macro12</SPAN><br>        <SPAN style="color:#00007F">Case</SPAN> "Name"<br>            MsgBox "Name"<br>            <SPAN style="color:#007F00">'Call Macro13</SPAN><br>        <SPAN style="color:#00007F">Case</SPAN> "Type"<br>            MsgBox "Type"<br>            <SPAN style="color:#007F00">'Call Macro14</SPAN><br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 

Watch MrExcel Video

Forum statistics

Threads
1,123,535
Messages
5,602,217
Members
414,513
Latest member
junbuggle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top