+ Reply to Thread
Results 1 to 7 of 7

Clear All Dropdown Listindex

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Clear All Dropdown Listindex

    Hi,

    I want to clear all contents of cells after completing macro for creating months. Range that needs to be cleared also contains dropdown shapes, which have code for inserting their values into cells under.

    I want to set all dropdown Listindex-es to blank (-1), so that all cells in desired range would really be cleared.

    Tried with this, but not working :

    Please Login or Register  to view this content.
    What am I doing wrong ?

    See attached sample, and look at Clear_cells and Dropdown_Change macros !

    Thanks for help in advance !
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Clear All Dropdown Listindex

    Hi Luka,

    I'm glad you got the conditional format working.

    Try the following to clear the list boxes (tested and working on my computer with your file):
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Clear All Dropdown Listindex

    Hi Luka,

    I'm glad you got the conditional format working.
    It was a little struggle, but sometimes you get fully paid

    About your code....Not quite what I was looking for.

    I tried It, but in this sample It doesn't work If I call It from Clear_Cells macro. It's should be placed there, just before all cells are being cleared.

    However, It works separately, but when code is executed It adds blank ListFillRange to shape. If you try to click on shape after that, you'll notice shapes don't have their drop-down list anymore, which is not what I want. Just want to give them blank value & leave drop-down lists. I think that could be done with ListIndex, first index of shapes is blank.

    This is how I tried your code :

    Please Login or Register  to view this content.
    Maybe code for shapes is also interfering (DropDown_Change macro) ?

    Also, check 1st day in December - It's deleting everything there, not sure why.
    Last edited by Lukael; 07-28-2014 at 05:07 PM.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Clear All Dropdown Listindex

    My original worked, but I misunderstood what you wanted. I thought you wanted the lists removed. What you really wanted was for each DropDown to be blank.

    I tested the following on your sample workbook, and it seemed to be working, including December 1st.

    Lewis


    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Clear All Dropdown Listindex

    Much closer, but still someting wrong with this code.

    It does clear all drop-downs, but cells in range still don't clear, not sure why as you made all code before Clear.Contents code

    See this screenshot for February !
    Attached Images Attached Images

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Clear All Dropdown Listindex

    The .ClearContents line seemed to be causing a lot of problems. I replaced it with a line that sets to "" (NO VALUE) all cells that have 'Data Validation'.

    Try this (changes from the previous version I posted are in red):
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Clear All Dropdown Listindex

    Hi LJMetzger,

    I allready know that, and thanks to nilem on other thread I have solved this issue. A stupid mistake in this line was done by me:

    Please Login or Register  to view this content.
    A DOT was missing, now It works !!! Same goes for your code, thanks a lot !!!

+ 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] Auto-clear dependent dropdown when parent cell is changed
    By Ceekimmy in forum Excel - New Users/Basics
    Replies: 12
    Last Post: 10-03-2023, 02:01 AM
  2. [SOLVED] Auto Clear Multiple Dependant Dropdown Lists
    By Nexial in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2014, 11:15 AM
  3. Clear cell contents based on value selected in a dropdown list
    By dpleventhal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2013, 04:45 PM
  4. Replies: 2
    Last Post: 06-10-2013, 09:41 AM
  5. Change cell from dropdown list and clear other cells in row
    By Dale Schultz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2012, 09:30 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