+ Reply to Thread
Results 1 to 2 of 2

REVISED-VBA code to relock multiple cells and paste identical formula into same cells

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007, 2010 (Depends on computer I am using.
    Posts
    2

    REVISED-VBA code to relock multiple cells and paste identical formula into same cells

    I have a simple Excel spreadsheet and what I'm trying to do is set up a VBA code to change a group of 6 cells, to lock the cells and to put an identical formula in the six cells which are all altogether. The 6 cells are linked to a validated list of three items, a Blank, Yes and a No. If selecting the Blank (default) and Yes the cells are locked and the formulas active, when you select No, the cells become unlocked so that person can put something in them. What I want to be able to do is lock the six cells back up using the validated list by selecting Blank or Yes and then have the VBA code reapply the formula to the cells even if they have been cleared.

    Here is the spreadsheet with the VBA code as well.

    Thanks for any help you can provide.

    Tim
    ~~~~~~~~~~~~
    Maybe I didn’t post correctly. I apologize if I neglected to correctly phrase my query so I will go into greater detail, as I see others have.

    Cell D12 is a Data Validation list comprised of 3 items, 1) Blank, 2) Yes, 3) No.
    Cells E13:F15 is the block of cells affected by what is selected in cell D12.
    Cells E13:F15 all have the exact same formula in them and also have conditional formatting to shade them grey when they are unlocked.
    Formula is “=IF($D$12=$U$21,"NA","")” U-Column is when the Data Validation list is located.
    The default for the 6 cells is locked and the spreadsheet is also locked.
    The VBA code I currently have linked to all this unlocks the sheet at beginning, locks it at the end and depending on which list item I select, it will do 1 of 3 actions.
    If I select the “Blank”, which is the default, nothing happens.
    If I select “Yes”, cells E12, E13:F15 all are populated with an NA via an in-cell formula.
    If I select “No” cells E13:F15 are unlocked and shaded and E12 stays blank.
    This allows data entry into cells E13:F15 which also removes the formula.
    When cells E14 and F14 have numeric data entered into them cell E13 shows the resultant output of them via a formula.
    The VBA code allows me to switch between the 3 data validation list items at will, but will not re-enter the formula if it is deleted. I currently have to exit the form and re-open it from the network to get the formulas back.

    I need to modify the VBA code to re-enter the formulas when I select Data Validation items “Blank” and “Yes” as well as continuing to do what it currently does.

    Here is the VBA code;
    Please Login or Register  to view this content.
    Thanks again for any assistance someone could provide.

    Tim
    Attached Files Attached Files
    Last edited by FJ1200SC; 11-16-2012 at 06:15 PM. Reason: To clairify my request for help

  2. #2
    Registered User
    Join Date
    11-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007, 2010 (Depends on computer I am using.
    Posts
    2

    Re: REVISED-VBA code to relock multiple cells and paste identical formula into same cells

    Anyone? Bueller? Bueller? Bueller?

+ 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