View Full Version : Solved: Hide Buttons in code?
blackie42
05-29-2008, 07:26 AM
Hi
I have a userform that has a combo box. What I'd like to do is make buttons visible/invisible on certain sheets depending on the value in the combobox - is it possible?
e.g if combox.value = x then button1.visible =true?
Not sure if they act the same way as buttons on a userform?
thanks
Jon
Bob Phillips
05-29-2008, 08:25 AM
Public Sub DropDown1_Click()
With ActiveSheet.DropDowns("Drop Down 1")
Worksheets("Sheet 1").Buttons("Button 1").Visible = .Value = 1
Worksheets("Sheet 1").Buttons("Button 2").Visible = .Value = 2
Worksheets("Sheet 2").Buttons("Button 3").Visible = .Value = 3
Worksheets("Sheet 3").Buttons("Button 4").Visible = .Value = 4
End With
End Sub
blackie42
05-29-2008, 09:10 AM
Thanks for reply - not sure if I explained properly
I've got 2 commandbuttons on WS1, 2 on 2, 2 on 3 and 3 on 4 and have assigned macros to them which open further userforms.
If I select a certain item from the combobox on the main userform (which opens with the WB) I want to hide commandbutton 3 on sheet 4.
Can you explain further how this would woek with your code?
regards
Jon
Bob Phillips
05-29-2008, 09:21 AM
You need to adapt my code, which was just an example, to reflect your dropdown name, your dropdown values, your sheet names, and your button names.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.