+ Reply to Thread
Results 1 to 4 of 4

lock and insert formula in a cell based on selection of text in another cell

  1. #1
    Registered User
    Join Date
    10-31-2014
    Location
    Riyadh
    MS-Off Ver
    2013
    Posts
    3

    Unhappy lock and insert formula in a cell based on selection of text in another cell

    I am having an issue on Excel. I have a drop down menu in cell D5, with three options, A, B, and C.

    If A is to be selected, cell content in D6 should become zero/clear-out [i.e., available for manual input by user], and cells D7, D8 and D9 should be locked while having formulas assigned to them as follows: for D7, =D6*G9, for D8 = D6*G10, for D9 = D6*G11

    Similarly, if B is to be selected, cell content in D7 should become zero or clear-out, and cells D6, D8 and D9 should be locked while having the following formulas assigned to them for D6 = D7*G8, for D8 = D6*G10, for D9 = D6*G11

    And lastly, if C is to be selected, cell content in D8 and D9 to be zeroed out and available for user input, while cells D6 and D7 are locked out and have following formula assigned to them: D6=(D8+D9)*I9, D7= D6*G9

    I am completely novice on VBA in Excel and clueless as to how to solve this issue.

    I got a code by googling which helps me to lock out cells, but I have no idea how to blank out cells and assign formulas.

    The issue is, if I just type in the formula, lets say in D6, and user selects option A in dropdown, he will have option to overwrite value in D6 and later on if option B or C is chosen, D6 will remain static instead of moving in line with the values input in D7-D9 when options B/C are chosen.

    Can someone please help

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: lock and insert formula in a cell based on selection of text in another cell

    Assalamualaikum

    Please try this attached file & i hope this will work for you as you want
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Registered User
    Join Date
    10-31-2014
    Location
    Riyadh
    MS-Off Ver
    2013
    Posts
    3

    Re: lock and insert formula in a cell based on selection of text in another cell

    Walekum Salaam
    Naveed, you are a life saver... thank you so much!!!
    I could hug you right now!!!

  4. #4
    Registered User
    Join Date
    10-31-2014
    Location
    Riyadh
    MS-Off Ver
    2013
    Posts
    3

    Re: lock and insert formula in a cell based on selection of text in another cell

    Salaams Naveed
    Follow-up question. If I need to do the same thing in two columns of the sheet, column D is already done, what to do for Column E. I suppose simply copy pasting the code below in the VBA window and replacing D to E won't really work.
    All the logic remains same, just need to duplicate same settings on column E to have two columns have these properties.

+ 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. Replies: 0
    Last Post: 03-20-2014, 10:57 AM
  2. Replies: 1
    Last Post: 03-11-2013, 03:10 PM
  3. Replies: 1
    Last Post: 03-10-2013, 01:54 PM
  4. Replies: 1
    Last Post: 05-07-2010, 11:23 AM
  5. Lock data in a cell a specific cell based on selection on other ce
    By CrimsonPlague29 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-10-2006, 06:10 AM

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