?
Solved

Excel VBA: Can I enable only one shape for inserting into a cell & disable all others

Posted on 2013-10-31
1
Medium Priority
?
736 Views
Last Modified: 2013-11-07
Hi,
I would like the user to be able to insert only one shape inside a cell. Therefore, I'd like to disable all other shapes and/or objects. Preference for enabled shape would be something simple, eg; rectangle.

I don't think you need to know what VBA code I already have but here is an example for the workbook just in case:
 With Sheet1 'AO5 tech
       .Protect Password:="password", UserInterfaceOnly:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowInsertingHyperlinks:=True, DrawingObjects:=False, Contents:=True, Scenarios:= _
        True
       .EnableOutlining = True
    End With
    

Open in new window


Hope this makes sense!
0
Comment
Question by:kazmdav
[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
1 Comment
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 39615778
If you set DrawingObjects:=True when you protect the worksheet, the user will not be able to insert a shape. But you can do so with a macro.
Sub Protector()
With Sheet1 'AO5 tech
       .Protect Password:="password", UserInterfaceOnly:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, _
            AllowInsertingHyperlinks:=True, DrawingObjects:=True, Contents:=True, Scenarios:=True
       .EnableOutlining = True
    End With

End Sub

Sub NewShape()
ActiveSheet.Shapes.AddShape msoShapeRectangle, ActiveCell.Left, ActiveCell.Top, ActiveCell.Width * 0.9, ActiveCell.RowHeight * 0.9
End Sub

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

800 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