Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hide / Show shape, if worksheet is Locked / Unlocked

Posted on 2015-01-31
4
Medium Priority
?
105 Views
Last Modified: 2016-02-10
Hello Experts,

Please view attached screenshot.

togglehide.PNG
In the screenshot above, the worksheet is locked.  Is there VBA code (I assume that is the only way to accomplish this) that will look at the "Employees" worksheet, and if the worksheet IS locked, then the "Toggle" button is INVISIBLE.  And when the worksheet is unlocked, then the "Toggle" button is VISIBLE.

Every worksheet has it's own toggle button that I will be applying this to.

I assume you will need to know the name of the "Toggle" button, but I don't know where to find it's name, or even if it does in fact have a unique name.  

Thank you in advance for your help!
0
Comment
Question by:Geekamo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Expert Comment

by:gowflow
ID: 40581448
Could you just post the workbook ?
Yes we can do this via VBA
gowflow
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 40581560
This is the syntax you require.
    ' for an ActiveX button
    Me.ButtonName.Visible = ActiveSheet.ProtectContents = True
    ' for a Form button
    ActiveSheet.Shapes("ButtonName").Visible = ActiveSheet.ProtectContents = True

Open in new window

Every control (including buttons have a unique name, to find that name right click on the control (you may have to click on "Design" from the developer tab first), the name will be visible in the "Name" drop-down box on the top right corner of your screen, or type
?Selection.Name

Open in new window

and hit ENTER in the immediate window (Ctrl+G to open it)
0
 
LVL 1

Author Comment

by:Geekamo
ID: 40583109
Thank you MacroShadow! :)
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40583292
You're welcome, glad to be of assistance.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question