form controls and macros

dilleyo725

Board Regular
Joined
Jan 31, 2006
Messages
65
Hi,

I'm trying to implement a combo box with a "yes" and "no" option. What I'd like to do is have a macro run if the "yes" drop down was selected. The macro would simply unhide some additional rows to allow the user to complete more information.

I'm not too savvy with combo boxes and my experience with macros is limited. I just created the macro using the record button and assigned it but I need it to run ONLY for the yes option. How do I do that?

thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hello,

can you change the Combobox to DATA VALIDATION?

If so, the code could be run on a WORKSHEET_CHANGE event.
 
Upvote 0
that's a good idea. But I'm not familiar on how to create/run code on a worksheet change event. Would you be able to walk me through that? Or point me in the right direction?

thanks again.
 
Upvote 0
Hello,

In your spreadsheet, right click the mouse over the relevant sheet tab, and select VIEW CODE. Paste the following code into the new window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
        If Target.Value = "YES" Then
            'your code here
        End If
    End If
End Sub

change A1 to your cell, and add code as required.

am about to go home, any problems, there are many people who can help.
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,090
Members
448,944
Latest member
sharmarick

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
Back
Top