+ Reply to Thread
Results 1 to 3 of 3

Lock Picture Only - When unlock sheet temporary for clear

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-27-2008
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    235

    Thumbs up Lock Picture Only - When unlock sheet temporary for clear

    Hi,

    In my coding, I am clearing used range with Clear function. (I do not want to use clearcontens)
    In Used range in center I have picture. (Name Picture 1).

    My problem,
    1. I am unlocking sheet with using code , code set with function properly
    Sheet14.Unprotect password:=password
    2. Clearing used range given name as "MyRange"
    MyRange.Clear
    This creates problem that cells cleared having format Lock cells, if I lock sheet again to protect picture from delete then my sheet affects in used range to locked cells. (I do not want to use clearcontents)

    3. Main thing requires, I want that picture 1 should be locked, which can't be deleted or moved at any reasons while following above codes.

    Thanks for your time.

    Regards, RR1050

  2. #2
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Lock Picture Only - When unlock sheet temporary for clear

    try this :
    Sub SelectUnlockedCells()
     Dim c As Range, r As Range
     For Each c In ActiveSheet.UsedRange
         If c.Locked = False Then
             If r Is Nothing Then
                 Set r = c
             Else
                 Set r = Union(r, c)
             End If
         End If
     Next
     If r Is Nothing Then Exit Sub
     r.Select
     End Sub
    it selects only unlocked cells
    you can add to this :
    Selection.clear
    or just make the above
    r.clear
    I have not tested this, so my apologies in advance if this does not work 100%

  3. #3
    Forum Contributor
    Join Date
    12-27-2008
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    235

    Re: Lock Picture Only - When unlock sheet temporary for clear

    Thanks for your time.

    Yes I like your thoughts.....

+ 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. lock/unlock specific cell in a password protected sheet
    By Opi in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 03-01-2016, 04:43 AM
  2. How to clear temporary files?
    By Terressa in forum Excel General
    Replies: 0
    Last Post: 07-02-2015, 02:43 AM
  3. [SOLVED] Macro to unlock sheet, copy to new workbook, then re-lock original sheet
    By Foos Master in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-08-2015, 09:16 PM
  4. [SOLVED] VBA to auto-unlock a worksheet and then re-lock that sheet
    By Foos Master in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-08-2015, 09:14 PM
  5. Replies: 1
    Last Post: 02-15-2006, 01:45 PM
  6. i want to lock a tab in excel, and unlock in another sheet
    By john tempest in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2005, 01:10 PM
  7. How do a lock a picture to the rest of the spread sheet row entry
    By Captain Paul in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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