+ Reply to Thread
Results 1 to 9 of 9

Ignore blanks at end of Dynamic Validation List

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Ignore blanks at end of Dynamic Validation List

    Hey, sorry for having to post this, but I just cannot figure out how to create a dynamic validation list. I have a list that starts in L6 that re-populates via vba each time the workbook is opened. The number of items on this list will vary each time, and this list is then linked to a data validation list that allows the user to choose the file to open. How do I ignore blanks at the end of my validation list? I don't have any blanks in my list, but the number of blanks at the end will differ each time the workbook is opened.

    In the name manager on another project, I used =OFFSET(Main!$O$11,0,0,COUNTA(Main!$O$11:$O$501),1) for a named range and then set my the validation list = to this named range, but when trying to use the same formula (but tweaked a little for my new range) I get an error that says "The Source currently evaluates to an error. Do you want to continue?" when setting my validation list = to this named range. What am I doing wrong here?

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Ignore blanks at end of Dynamic Validation List

    Maybe get rid of the 0s
    =OFFSET(Main!$O$11,,,COUNTA(Main!$O$11:$O$501),1)

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Ignore blanks at end of Dynamic Validation List

    Just tried it, got the same error when assigning the named range to the validation list

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Ignore blanks at end of Dynamic Validation List

    Can you post your workbook?

  5. #5
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Ignore blanks at end of Dynamic Validation List

    Quote Originally Posted by JieJenn View Post
    Can you post your workbook?
    Workbook is attached. I've commented out my vba for the open workbook event so it doesn't run when you open. Pardon the broken link upon opening the file, this literally just reared its head and I haven't had time to rectify it yet. Thanks for taking a look!
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Ignore blanks at end of Dynamic Validation List

    This should be your defined name. You were using the COUNTA function where the row offset is (you don't want to offset from L6) It should be where height is. Like so

    =OFFSET('Extract Codes'!$L$6,0,0,COUNTA('Extract Codes'!$L$6:$L795),1)
    also you didn't have ' around your sheet name which is necessary when you have blanks in your sheet names.

    Did that help?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Ignore blanks at end of Dynamic Validation List

    Quote Originally Posted by ChemistB View Post
    This should be your defined name. You were using the COUNTA function where the row offset is (you don't want to offset from L6) It should be where height is. Like so

    =OFFSET('Extract Codes'!$L$6,0,0,COUNTA('Extract Codes'!$L$6:$L795),1)
    also you didn't have ' around your sheet name which is necessary when you have blanks in your sheet names.

    Did that help?
    Excellent. Thanks a bunch! Thanks you too JieJenn!

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Ignore blanks at end of Dynamic Validation List

    The OFFSET Formula isn't quite right.

    I think it should be something like this.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  9. #9
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Ignore blanks at end of Dynamic Validation List

    Thank you too Norie!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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