Enable / Disable Shapes


Board Regular
Aug 24, 2007
Hi All,

I have a excel template where I have 8 shapes created as button and assigned a macro to each shape.

Is there a option to disable the Shapes where the users are unable to click the shapes to run the macro.

For example:

I have a shapes with names Login and Logout.

When the excel is opened i want Only the Login is enabled where the user is allowed only to click the Login button and once the Login is clicked i want this to be disabled and enable the Logout Shape is active. this will prevent the user from clicking the Login shape which they have already selected. So they are left with option to click only the Logout shape.

Thanks in advance.

Vimal Vikraman.


Well-known Member
Dec 30, 2008
Office Version
The simple way would be to declare a public variable as Boolean, set it to True with the login code and False with the logout code.
Then add a line to the code for Login to exit the sub if the variable is True, do the same for Logout if the varaible is False.

You could use the variable to set the shapes visible / hidden instead of disabling them. Setting the default for each button in a workbook open event. *Note that this will not work with a shared workbook*

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...