Hide button on worksheet if there is nothing contained in cell E24

TheJay

Active Member
Joined
Nov 12, 2014
Messages
364
Office Version
  1. 2019
Platform
  1. Windows
I've written some code but it's not working and I am not sure why.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    If Cells(5, 24).Value <> "1" Then
        ActiveSheet.Shapes("Button412").Visible = True
        Else
        ActiveSheet.Shapes("Button412").Visible = False
    End If
    Application.ScreenUpdating = True
End Sub

I want to make sure the button is hidden when the sheet is opened and only when a value appears in E24 should the button appear.

Could someone please point out my mistake and how to fix it?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Your link takes me to the sign-in screen. I need a direct link to your file.
 
Upvote 0
Sorry, copied the link as usual.

 
Upvote 0
The problem is that the formula in E24 returns a value in hours and minutes which will never equal "1". Can you explain in more detail what time has to be displayed in E24 so that the button is hidden?
 
Upvote 0
The problem is that the formula in E24 returns a value in hours and minutes which will never equal "1". Can you explain in more detail what time has to be displayed in E24 so that the button is hidden?
Thanks for your reply. It could be any amount of time between a minute and 24 hours for example.

H:MM
 
Upvote 0
So if any time is displayed in E24, you want the button hidden and if E24 is blank, you want the button visible. Is this correct?
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top