View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Johanna Gronlund Johanna Gronlund is offline
external usenet poster
 
Posts: 32
Default 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
.