+ Reply to Thread
Results 1 to 8 of 8

Change cell value based off list choice

  1. #1
    Registered User
    Join Date
    03-21-2019
    Location
    Minnesota, USA
    MS-Off Ver
    2016
    Posts
    4

    Change cell value based off list choice

    This seems like it should be simple, but for the life of me I can't find a solution.

    I have a list in cell A1 with Yes and No option. Cell A2 contains a number to be entered by the user, however I would like this cell to be changed to 0 if the selection from list in A1 is "No". Does anyone have a solution for this?

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Change cell value based off list choice

    I think you would have to use event code to make the cell = 0 since it is a user input cell.


    Please Login or Register  to view this content.
    You can put this in the sheet code module and it will run when the value in Cell A1 changes.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    03-21-2019
    Location
    Minnesota, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Change cell value based off list choice

    Awesome that works great! Thanks. If I have other cells that I need to accomplish the same thing would I just put multiple versions of this code and change the cell references accordingly?

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Change cell value based off list choice

    No, you cannot have multiple versions of worksheet event code. You can possibly incorporate the others into the same code. If you can explain the conditions I will try to modify the code for you.

    You can have different code for different events, but only one code per event.
    Last edited by JLGWhiz; 03-21-2019 at 05:14 PM.

  5. #5
    Registered User
    Join Date
    03-21-2019
    Location
    Minnesota, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Change cell value based off list choice

    Sorry I should have included that. I have multiple rows that need this logic A8:A28 has the list and change E8:E28 to 0 if "No". I know cell references differ a bit from my original post, but I just modified your code to reflect my actual cells. These are my actual cell references.

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Change cell value based off list choice

    Please Login or Register  to view this content.
    Be sure to delete the other code before trying to run this one.

  7. #7
    Registered User
    Join Date
    03-21-2019
    Location
    Minnesota, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Change cell value based off list choice

    Works perfect! Thanks

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Change cell value based off list choice

    Quote Originally Posted by Broncswon View Post
    Works perfect! Thanks
    You're welcome, don't forget to mark the thread as solved.
    regards, JLG

+ 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. [SOLVED] Change rows' text colour based on drop down list choice
    By CrMitch90 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-08-2017, 12:31 PM
  2. Replies: 1
    Last Post: 10-26-2016, 08:54 PM
  3. Change Formula based on value of drop drown choice
    By snuffnchess in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2015, 11:33 AM
  4. Write Macro Code to Change based on User Choice
    By AStevenG in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2014, 10:25 PM
  5. [SOLVED] Cell reference based on another cell choice from a drop down list.
    By enoch5939 in forum Excel General
    Replies: 2
    Last Post: 12-07-2012, 12:04 PM
  6. Replies: 2
    Last Post: 08-14-2006, 02:00 PM
  7. Forcing value based on list choice??
    By Potoroo in forum Excel General
    Replies: 2
    Last Post: 07-11-2006, 04:17 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