Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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
.

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
Hide Rows based on Combobox Selection Katie Excel Programming 17 March 2nd 10 03:46 PM
how can I unhide/hide a sheet based on pull down selection? Keith Excel Discussion (Misc queries) 1 August 12th 08 04:17 PM
Hide and Unhide Rows button FinlandGuy Excel Programming 6 December 12th 07 11:58 AM
hide or unhide rows with button Bea Excel Discussion (Misc queries) 15 September 19th 07 07:03 PM
Excel should have unhide all worksheets selection or button. JMayers97 Excel Worksheet Functions 1 April 19th 06 05:07 AM


All times are GMT +1. The time now is 05:02 AM.

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"