+ Reply to Thread
Results 1 to 2 of 2

Lock cells based on color from conditional formating

  1. #1
    Registered User
    Join Date
    02-26-2010
    Location
    San Bernardino, CA USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Lock cells based on color from conditional formating

    Hello,

    I have created a payroll spreadsheet that only certain fields for corresponding days within a pay period need to be edited. There are certain days of the week (i.e.: Tuesday) that we have a product or products that are distributed that employees need to be paid on. I am trying to acheive the following:

    =IF(WEEKDAY(D8)=3,do nothing,change cell to color -4105 and lock)


    I initially had a formula written in the cell as such:

    =IF(WEEKDAY(D8)=3,"1","")

    ...with a conditional formatting rule description of "format only cells with blanks, return color -4105"

    ...and a VBA code entered as the following:

    Please Login or Register  to view this content.
    The problem that I have encountered is that if I select the unlocked cell and then change the "1" to anything else, I have overwritten the formula. Even worse, if I accidently delete the "1" and hit enter, I am locked out of the cell due to my conditional formatting and VBA code. I have tried to create an Interior.Color clause within the VBA code but I haven't had any lock because what I am understanding is that VBA does not see color changes from conditional formatting. Any ideas? I have been searching forums for about a week now!
    Last edited by Paul; 02-26-2010 at 03:01 PM. Reason: Added code tags

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Lock cells based on color from conditional formating

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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