+ Reply to Thread
Results 1 to 5 of 5

Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

  1. #1
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

    The files in the outlined area need to be protected except when documents need to be added or deleted, so I have a Lock/Unlock button for protecting the cells in that range.

    This code snippet is as close as I have been able to come to allowing .pdf files to be inserted, moved around and deleted from the outlined range (B26:C37) while the sheet is protected. The problem is that there are a couple of show/hide pictures outside of the that range that toggle red (locked) or green (unlocked) based on whether the range is locked from editing or not, and the snippet also unprotects them. I'd like them to stay protected with the rest of the sheet. Is there a way to apply this to just B26:C37?
    Please Login or Register  to view this content.
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    08-08-2014
    Location
    Lancaster, PA
    MS-Off Ver
    2016 (windows & mac)
    Posts
    94

    Re: Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

    you could take this approach

    Please Login or Register  to view this content.
    set the protection with DrawingObjects:=True then loop all Shapes in the Worksheet, test if they intersect with the OutlinedArea. if so then unlock them so the items inside the OutlinedArea remain unlocked, whilst anything outside the OutlinedArea is locked.

    it's not ideal and a bit of a hack, but hopefully it will achieve what you want.
    Last edited by thatandyward; 07-12-2017 at 10:01 AM.

  3. #3
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

    I changed "Sheet1" to the actual sheet name.

    It crashes at the yellow point in the code and gives this message:

    Run-time error '1004'

    Application-defined or object-defined error
    Attached Images Attached Images

  4. #4
    Registered User
    Join Date
    08-08-2014
    Location
    Lancaster, PA
    MS-Off Ver
    2016 (windows & mac)
    Posts
    94

    Re: Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

    I didn't really mean for the code to be run as a solution to your problem, more as an illustration of a possible approach you could take with respect to determining a shapes position relative to a defined range.

    I don't know the specifics of what shape objects you have on your sheet, I suspect the error is caused by trying to apply the .locked property to a shape type that can't accept it - although I'm not that familiar with all the different flavors of shape objects so not really sure.

    I would suggest testing the shape type, either with a simple IF…THEN statement or, if you have multiple shapes, a Select Case statement, and then adding the relevant code depending on the shape type and what you want to do

  5. #5
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: Can DrawingObjects:=False be applied to a range instead of the entire worksheet?

    Sorry, I misunderstood.

    Thanks. I'll try what you suggested.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Specifing entire worksheet as range to export sheet to access
    By UML in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2015, 05:41 PM
  2. [SOLVED] Macro DrawingObjects=false, but cannot insert a picture?
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2014, 12:17 PM
  3. Conditional format using text applied to entire row
    By bopsgtir in forum Excel General
    Replies: 1
    Last Post: 12-02-2010, 12:02 PM
  4. Table Array Entire Worksheet Instead Of Named Range
    By Spencer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-02-2007, 11:18 PM
  5. Address Entire Worksheet as a range
    By Klatuu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2006, 03:30 PM
  6. Replies: 1
    Last Post: 02-18-2006, 07:55 PM
  7. Macro to print a selected range, not entire worksheet
    By James C in forum Excel General
    Replies: 3
    Last Post: 10-19-2005, 05:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1