• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Change font colour on Button on opening

I have a button (Button 5459) on my sheet, I would like the button to be disabled when the spreadsheet is opened and the texted to be gray.

I then need the box to be enabled once a value >1 is entered to O42 and the texted on the button (Button 5459) to become black.

Apologies if I have put this into the wrong place on the forum.
 
Hi lesley,

I'm going to presume that the this is an ActiveX Command button, and not a Forms button, as the latter can't be disabled. If not, please insert this button
upload_2015-8-27_9-21-30.png

Anyway, once you have it in place, two bits of code. In the ThisWorkbook module:
Code:
Private Sub Workbook_Open()
Worksheets("Sheet1").CommandButton1.Enabled = False
End Sub

In the sheet module for the button (where cell O42 is)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Me.CommandButton1.Enabled = (Range("O42").Value > 1)
End Sub

Note that disabling a button automatically turns the font gray, and vice versa.
 
Hi

Thank for your response. I am having to use a form control button as for some reason I cannot insert an active x object into excel. If I can't change a for control button I will have to find another way around.
 
Back
Top