+ Reply to Thread
Results 1 to 11 of 11

Unlock Cells With Certain Color

  1. #1
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Unlock Cells With Certain Color

    Hi!

    Does someone know how to, via a VBA code, unlock all the cells from my workbook that has Interior.Color = 10092543

    Thanks!!

    Kind regards,

    pezal

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unlock Cells With Certain Color

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Unlock Cells With Certain Color

    I think you may have forgot to add the part about unlocking the cell. Amended your code

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unlock Cells With Certain Color

    Cheers, think I forgot more than that!

  5. #5
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Re: Unlock Cells With Certain Color

    Hello yudlugar,

    Thanks for the code! I finally adapted this way:

    Please Login or Register  to view this content.

    The code is running okay but I discovered that those cells which have been edited via a conditional formatting, wont unlock using this code. Seems like the Interior.Color = 10092543 does not correspond to that one that the conditional formatting is applying... could that be correct? Is there a way to check which fill color does a cell have?

    Thank you very much.

    Regards,

    pezal

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unlock Cells With Certain Color

    You are correct, conditional formatting doesn't change the interior.color property.

  7. #7
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Re: Unlock Cells With Certain Color

    Hi stnkynts,

    I have just seen your code, thanks!

    Your code runs perfect but I discovered that all cells that were colored via a conditional formating wont unlock using the vba code... I think that is maybe because the fill color from those cells is not exactly the same as put in the macro. The thing is that I dont know how to check what the fill color from those cell is.

    Regards

  8. #8
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Re: Unlock Cells With Certain Color

    Yes but I would like to just unlock the cells, not to change the interior color...

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Unlock Cells With Certain Color

    @pezalmendra. What yudlugar is saying, is that if you change the color of a cell using conditional formatting a macro will not be able to recognize that the cell has changed color. If this is a must, it would be best to have a macro color the cells or find a different parameter to apply the "unlock" macro to.

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unlock Cells With Certain Color

    You can pick up the colour of conditional formatting from:
    Please Login or Register  to view this content.
    and you can get the formula for the conditional formatting from:
    Please Login or Register  to view this content.
    So in principle, you could test whether the format condition is true and then pick up the appropriate colorindex.

    Note - I've not actually done this before, I'm guessing there is an easier way of doing this but this was just what sprung to mind.

  11. #11
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unlock Cells With Certain Color


+ 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 Macro for Entire Row linked to Color-Changing Shape
    By sumkynduvstrange in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2013, 10:27 AM
  2. unlock cell by color
    By dvb_24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2010, 07:10 AM
  3. Replies: 0
    Last Post: 09-06-2005, 04:05 AM
  4. Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. 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