+ Reply to Thread
Results 1 to 22 of 22

Code to restrict cell input until another cell is populated

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Code to restrict cell input until another cell is populated

    Hi,

    Please help me to write a code for

    I would like to restrict the user's ability to input data in cell B1 (Cell B1 is having drop down list) until cell A1 is populated with a number. How is this done?


    Thank you for your help.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Assume that your B1 Validation List Consist the below reference to list in dropdown..
    $F$1:$F$3

    Change the B1 Validation List range reference to

    =IF(A1<>"",$F$1:$F$3,"")

    And give ok…

    Check and confirm


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thanks for your immediate response,

    but when I am using this formula I am getting error : "The list source must be delimited list, or a reference to single row or column"

    Please help me

    Thank you for your help

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Yes because you are using Multiple column reference in the Validation List.

    If you see in my suggested reference $F$1:$F$3 I just used a single column Reference (i.e.) Column F alone.

    So don't use multiple column reference in Validation List.

  5. #5
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    No i also used only one column I copied same formula but it is not working it is showing same error

    Thank you

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Please share the range reference with us which you are trying to add in the Validation List...

  7. #7
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Validation list Range is F1 to F3

    Thank you

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    It should work please share the complete formula or screenshot or sample workbook for getting better understanding

  9. #9
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much for your timely help and sorry for bothering you

    Please find attached excel file

    Once again I am explaining what I am expecting

    In column A i have drop down list when I entered some thing in cell A1 then only Cell B1 will allow to enter some data (column B is also having drop down list). If A1 is 'blank' or '0' then if user trying to enter any value in B1 it has to show error.

    Thank you
    Attached Files Attached Files

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Thanks for the sample file. Now I understand your problem clearly… Just do it for a single cell then afterwards we copy and paste it for the rest of the cells. Please follow the below steps…

    Place the cursor in B1 Cell ALONE>>Press Alt+D+L>>Settings>>Allow>>List>>Copy and paste the below formula

    =IF(A1="","",Stage)

    Click Ok…

    Now check deleting the a1 cell value and come to B1 and check the Drop Down item. It will work nicely.

    Now copy the B1 cell and Select B2 to B4 and paste.

  11. #11
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much for your help it is working.

    But when A1 is empty in B1 drop down list is not coming this is fine, but when i entered manually some value (whatever is there in the list) in B1 it is taking that value, I dont want to enter any value in B1 if A1 is empty or Zero

    Thank you

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    In this case we have to go for VBA for clearing the contents of the next column when the Column-A cell goes empty.

    Copy the below code and Do right click on sheet tab and select view code and paste the below code. Return to excel and check

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much but it is not working. When I entered Zero in A1 if is there any values already entered in B1 is clearing. But when I am trying to enter manually some numbers in B1 it is taking though there is a zero in A1 it is not showing any error.

    What I am expecting is: if I entered in Cell A1 is zero or I left blank then I am trying to enter some value in B1 it has to show error like 'A1 is zero/Balnk you cant enter any value in this cell'

    Sorry for bothering you

    Thank you

  14. #14
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Simple just remove the Zero from your Column-A Validation List. When Zero don’t have any roll then why we have to keep it in Column-A validation List Selection?

  15. #15
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Sorry I think I am wasting your time

    Actually this excel file is for validating some physical registers

    column B is dependent column on Column A. Here column A is we are looking completeness of one indicator in the register, if the indicator is complete they will enter 1, if indicator is not complete or not entered they will enter zero. If they will enter '1' in column A means there is some information for that indicator, then we have to enter that actual information in column B. if they enter '0'or left blank means there is no data for that indicator so there is no need to enter any thing in column B.

    Why we are giving validation is we are not allowing the user to enter any data in column B until unless the column A is '1'

    I think now I explained clearly

    Sorry for bothering you

  16. #16
    Forum Contributor aganesan99's Avatar
    Join Date
    04-26-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    129

    Re: Code to restrict cell input until another cell is populated

    Hi,

    Please check the attached file.
    See the steps in Method tab and a sample in the next tab
    Attached Files Attached Files
    Last edited by aganesan99; 11-11-2013 at 08:34 AM.

  17. #17
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much

  18. #18
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much,

    For this same validation is there any possible to put a drop down in Column B

    Thanks

  19. #19
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Code to restrict cell input until another cell is populated

    Surely, I will provide you the expected solution by tomorrow since now I am out of office and dont have any access to system.

    Sent from mobile device.

  20. #20
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much for your timely help

  21. #21
    Forum Contributor aganesan99's Avatar
    Join Date
    04-26-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    129

    Re: Code to restrict cell input until another cell is populated

    Hi,
    Please see the attached file.
    In the Method tab I have made some changes in the steps.
    It'll help you

    If it is useful click on "Add Reputation"

    Thanks,
    aganesan99
    Attached Files Attached Files
    Last edited by aganesan99; 11-11-2013 at 09:15 AM.

  22. #22
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Code to restrict cell input until another cell is populated

    Thank you so much it is working

+ 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. Restrict cell input until another cell is populated
    By Brandy in forum Excel General
    Replies: 7
    Last Post: 04-14-2017, 01:50 AM
  2. [SOLVED] Prompt input of future date in cell when another cell has been populated or modified
    By coffeemints in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 06:46 PM
  3. Restrict cell input based on another cell value
    By CrazyLarry in forum Excel General
    Replies: 4
    Last Post: 01-22-2013, 08:50 AM
  4. Code to restrict cell input until another cell is populated
    By Brandy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-20-2010, 11:29 AM
  5. Replies: 2
    Last Post: 01-25-2005, 04:06 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