+ Reply to Thread
Results 1 to 6 of 6

Macro to control number of rows that data validation drop down lists are copied down to

  1. #1
    Registered User
    Join Date
    03-29-2013
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    78

    Macro to control number of rows that data validation drop down lists are copied down to

    Is it possible to have a macro that will control the number of rows that data validation drop down lists are copied down to in a worksheet?


    More info:
    I have a sheet that contains data that goes down as far as row 400 and includes some columns with drop down lists copied down also as far as row 400. However during use, the user will delete any number of the rows above as data become obsolete and so (unless I am mistaken) this means that they will eventually start adding data into rows that don't have data validation.

    I would like a macro that automatically ensures that cells down as far as row 400** always have the appropriate data validation lists copied down for that column

    **(ideally this number, i.e. row 400, will also be controlled by using some kind of indirect reference, taking the number '400' as entered in a cells of a another sheet I have which is currently controlling the bottom row cell reference for various named ranges through an indirect function.)


    Thank in advance for any assistance!

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Macro to control number of rows that data validation drop down lists are copied down t

    I have an idea that might work but it would be easier to test on your actual file rather than having to guess at how your data is organized. Can you post a de-sensitized copy of your file?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

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

    Re: Macro to control number of rows that data validation drop down lists are copied down t

    Hi OLLY-7,

    I approach your problem from a slightly different point of view to keep the coding a little simpler by:
    a. Refreshing the 'Data Validation' on Worksheet_Activate()
    b. Doing a 'Data Integrity' Check and reporting to the user any cell containing 'Data Validation' (after being refreshed) whose value is NOT in the 'Data Validation' List.

    I hope this helps.

    Lewis

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Macro to control number of rows that data validation drop down lists are copied down t

    You have Excel 2010. This means you have Excel Tables. One of the things Excel Tables do is copy down formulas, validations and formatting when a new row is added. Depending on your data layout and procedures this might work for you.

    Here is some more information on Tables. http://www.utteraccess.com/wiki/inde...ables_in_Excel.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  5. #5
    Registered User
    Join Date
    03-29-2013
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    78

    Re: Macro to control number of rows that data validation drop down lists are copied down t

    Dear all,

    Thank you very much for your quick responses.


    dflak - I have looked into Excel Tables (I am actually running 2016 now actually) and yes these look like they would do exactly what I want... I.e. named ranges will reduce when rows are deleted but will also increase again when data is added, even if at the bottom of the table (i.e. the table auto extends) and yes you are right - the data validation also auto populates to these new rows!

    I think maybe this will also speed up the calculation on my workbook as the named ranges will only ever be as long as they need to be and will not be using the indirect function to recalculate the range lengths (although that does work and I was quite proud of myself for working that one out!).


    Mumps1 - thank you for your thinking about this. If you have time, might be interesting to see what is possible re. a macro to force data validation lists to always be 'copied' down to a specified row number, no matter how many rows are deleted above. But then again, you may also agree with the Excel Table solution(?).


    LJMetzger - I don't entirely follow what you are suggesting but sure it’s good! I'm not a macro wiz (can record and adapt a bit existing code but that's about it alas).


    I attach some stripped out workbooks with the two alternate routes should these be of use / interest.


    Thanks very much again in advance.


    Olly

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Macro to control number of rows that data validation drop down lists are copied down t

    Tables came along with Excel 2007 - at first I was confused by them. Now I don't know how I can live without them.

+ 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] Data Validation - drop-down lists
    By Trebor777 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-09-2016, 11:32 AM
  2. Drop-down lists, data validation
    By Trebor777 in forum Excel General
    Replies: 1
    Last Post: 08-17-2016, 10:36 AM
  3. [SOLVED] data validation lists - drop down lists too small
    By reglook0736 in forum Excel General
    Replies: 3
    Last Post: 04-24-2015, 12:49 PM
  4. Replies: 8
    Last Post: 01-23-2015, 02:32 PM
  5. [SOLVED] drop down lists / data validation
    By CashmereCat in forum Excel General
    Replies: 3
    Last Post: 10-11-2012, 12:35 AM
  6. [SOLVED] Data Validation and Drop down lists.
    By Mark Dullingham in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2006, 07:55 PM
  7. Data Validation - Drop down lists - if then?
    By Steve R in forum Excel General
    Replies: 2
    Last Post: 04-08-2005, 02:06 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