Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide/unhide a button based on selection in a combobox
Hello,
I have a problem that I would appreciate your input on. The excel file that I am working on has a combobox (Drop Down 573) on sheet "Results". The cell link is to cell T13 on the same sheet. When T13 = 4, I would like a button to appear (by this I mean be visible). Does anyone have any ideas how this might be done? Thanks, Johanna |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide/unhide a button based on selection in a combobox
You can use a macro that's assigned to the dropdown.
I added a button from the Forms toolbar (not the control toolbox toolbar). I named it Button 1. You'll have to modify the code to use the correct name for your button. Then I assigned this macro to the dropdown (rightclick on the dropdown and select "Assign Macro"). Option Explicit Sub testme() Dim myDD As DropDown Dim myButton As Button With ActiveSheet Set myButton = .Buttons("Button 1") Set myDD = .DropDowns(Application.Caller) If myDD.ListIndex = 4 Then myButton.Visible = True Else myButton.Visible = False End If End With End Sub If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) Johanna Gronlund wrote: Hello, I have a problem that I would appreciate your input on. The excel file that I am working on has a combobox (Drop Down 573) on sheet "Results". The cell link is to cell T13 on the same sheet. When T13 = 4, I would like a button to appear (by this I mean be visible). Does anyone have any ideas how this might be done? Thanks, Johanna -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide/unhide a button based on selection in a combobox
Thank you for the detailed instructions. It worked like a dream!
Johanna "Dave Peterson" wrote: You can use a macro that's assigned to the dropdown. I added a button from the Forms toolbar (not the control toolbox toolbar). I named it Button 1. You'll have to modify the code to use the correct name for your button. Then I assigned this macro to the dropdown (rightclick on the dropdown and select "Assign Macro"). Option Explicit Sub testme() Dim myDD As DropDown Dim myButton As Button With ActiveSheet Set myButton = .Buttons("Button 1") Set myDD = .DropDowns(Application.Caller) If myDD.ListIndex = 4 Then myButton.Visible = True Else myButton.Visible = False End If End With End Sub If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) Johanna Gronlund wrote: Hello, I have a problem that I would appreciate your input on. The excel file that I am working on has a combobox (Drop Down 573) on sheet "Results". The cell link is to cell T13 on the same sheet. When T13 = 4, I would like a button to appear (by this I mean be visible). Does anyone have any ideas how this might be done? Thanks, Johanna -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide Rows based on Combobox Selection | Excel Programming | |||
how can I unhide/hide a sheet based on pull down selection? | Excel Discussion (Misc queries) | |||
Hide and Unhide Rows button | Excel Programming | |||
hide or unhide rows with button | Excel Discussion (Misc queries) | |||
Excel should have unhide all worksheets selection or button. | Excel Worksheet Functions |