Hiding a macro button

B

Brad

The following logic works in the microsoft excel objects section [sheet1
(input)]

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("product").Address Then
Module1.visible_sheets
End If
end sub

Then I have another macro turn on and off sheets as needed. However, I
would like to hide the "print" macro button if the user inputs a retirement
age < issue age. The user could change either the issue age or the
retirement age at anytime once they are on the input sheet.

Currently, I'm have the retirement age being dynamically updated with
different retirement options. Both the retirement age and issue age are cell
in the "input" sheet.

I believe that the following code would work if I knew how to activate it.

If Range("valid").value <> 0 Then
Sheets("input").button17.Visible = False
End If
If Range("valid").value = 0 Then
Sheets("input").button17.Visible = True
End If

the valid field is found on input_info sheet (there is a good reason why the
the field is on a different sheet).

Thanks in advance for your help.
 
J

Jim Jackson

Use the macro below in the sheet's code window. (The sheet where
Range("valid") resides.

Private Sub Worksheet_Change(ByVal Target As Range)
' Your Code goes here
End Sub
 
B

Brad

I did what you suggested, went into the input sheet changes one of the ages
to trigger hiding the button and nothing happened.

The button is on the input sheet not the input_info sheet.

Jim Jackson said:
Use the macro below in the sheet's code window. (The sheet where
Range("valid") resides.

Private Sub Worksheet_Change(ByVal Target As Range)
' Your Code goes here
End Sub
--
Best wishes,

Jim


Brad said:
The following logic works in the microsoft excel objects section [sheet1
(input)]

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("product").Address Then
Module1.visible_sheets
End If
end sub

Then I have another macro turn on and off sheets as needed. However, I
would like to hide the "print" macro button if the user inputs a retirement
age < issue age. The user could change either the issue age or the
retirement age at anytime once they are on the input sheet.

Currently, I'm have the retirement age being dynamically updated with
different retirement options. Both the retirement age and issue age are cell
in the "input" sheet.

I believe that the following code would work if I knew how to activate it.

If Range("valid").value <> 0 Then
Sheets("input").button17.Visible = False
End If
If Range("valid").value = 0 Then
Sheets("input").button17.Visible = True
End If

the valid field is found on input_info sheet (there is a good reason why the
the field is on a different sheet).

Thanks in advance for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top