+ Reply to Thread
Results 1 to 6 of 6

Dynamic Range for clear cells on change

  1. #1
    Registered User
    Join Date
    10-01-2013
    Location
    Jupiter FL
    MS-Off Ver
    Excel 2010
    Posts
    6

    Exclamation Dynamic Range for clear cells on change

    I am working on a "SUPER RUSH--GET IT DONE LAST WEEK" project that requires a dynamic range of rows. There are dependent data validation drop down lists involved. I want to be able to clear cells when one of the drop down values changes.

    For example: User originally chose "Apples" from drop down list in Column E, then "Granny Smith" from drop down list in Column F, but wants to make it "Oranges", and "Valencia", or perhaps just clear that row and not make any more choices at this time.

    Based on their choice of Granny Smith Apples, a price populates automatically in Column G using INDEX MATCH MATCH formula. When the user changes their mind, I want to clear Column E and F, thereby clearing Column G automatically (but NOT clear the formula!). The user could clear Column E by deleting contents in Column E, or just making another choice.

    I have found code online that works for a static range, but only if user makes an alternate choice. I need to make it a dynamic range (not just "E22:E32"), AND/OR clear contents if user deletes previous contents.

    Please Login or Register  to view this content.
    I have not worked with vba for many years, so I am really having problems with something that should be relatively simple. Any help would be VERY APPRECIATED!!!!

  2. #2
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Dynamic Range for clear cells on change

    This may help

    The macro below will clear the cell contents below row 1.
    Columns B and C of the target row will be cleared if column A changes.
    Column C of the target row will be cleared if column B changes.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-01-2013
    Location
    Jupiter FL
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Dynamic Range for clear cells on change

    I appreciate your response, however, it doesn't seem to work. I replaced my original code with what you provided, and made the following changes:

    Please Login or Register  to view this content.
    This results in no changes at all, except the ones I initiate. Cells don't clear at all. Am I missing something? Am I being completely dense? (Wouldn't surprise me a bit right now -brain drain to the max...LOL)

  4. #4
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Dynamic Range for clear cells on change

    Try the following code

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-01-2013
    Location
    Jupiter FL
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Dynamic Range for clear cells on change

    That seems to work perfectly! Thank you!!
    Now, my boss is considering a change to the format of the project. If he goes with what he is thinking, I will need to have this stop at a certain place, but the row number will still be variable. How is the best way to do that? For example: same as above, only now he wants to add a Grand Total row, and have a totally different set of info below that. I will need the text clearing code to stop at the row above the Grand Total row so we don't have problems with the cells below. Sorry to change it up on you, but the boss is the boss!

  6. #6
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Dynamic Range for clear cells on change

    Uploading a sample workbook would be helpful

+ 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. Clear cells upon adjacent cell change
    By jwstimac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2013, 01:02 PM
  2. [SOLVED] Macro needed to clear cells in range based on value of cells in another range
    By msmith7113 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-05-2013, 12:32 AM
  3. Using an event change to clear cells in worksheet
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-15-2012, 08:34 AM
  4. Clear cells using a worksheet change event
    By headexperiment in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2011, 07:26 AM
  5. Workshet Change Event for dynamic range starting but not firing for target cells
    By leaning in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2010, 08:56 PM

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