+ Reply to Thread
Results 1 to 14 of 14

Loop through a data validations list and for each loop count the number of occurences

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Loop through a data validations list and for each loop count the number of occurences

    I have cross-posted this at https://stackoverflow.com/questions/...lidation-lists and on https://www.mrexcel.com/forum/excel-...ion-lists.html

    I am trying to loop through 2 pairs of data validation lists, 4 data validation drop downs in total.

    With every loop of the data validation lists I would like to count the number of occurrences of two symbols and

    then save the result of each loop in a variable or a worksheet or both.

    I have found a bit of code that I think could be a starting point to work from.

    Please Login or Register  to view this content.
    Last edited by waimea; 07-05-2018 at 12:14 PM.

  2. #2
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    I found this bit of code https://stackoverflow.com/questions/...-dropdown-list

    It doesn't work for me though.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    I think that a for each loop is what I am trying to do?

  4. #4
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    Any suggestions on what I need to read or learn to make this possible?

    Or any suggestions on how I should go about?

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Loop through a data validations list and for each loop count the number of occurences


    Just attach a workbook here …

  6. #6
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    attachment-doesn-work.png

    Attachment doesn't work for me at this forum, I am using Chrome but I just tried with Internet Explorer and the attachment part is just a tiny box
    Last edited by waimea; 07-03-2018 at 06:39 PM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Loop through a data validations list and for each loop count the number of occurences


    So just use any better webbrowser …

  8. #8
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    I have tried with two different browsers :/

  9. #9
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    Please Login or Register  to view this content.

    How can I improve this code? Instead of Debug.Print I would like to select a new worksheet and update the new worksheet?

    Also, I am using dependant drop downs for two of my four data validation lists and I get a type mismatch since I am using INDEX and MATCH to find the correct value.

    How can I change the code above to account for the type mismatch?
    Last edited by waimea; 07-04-2018 at 07:00 AM.

  10. #10
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    From this thread https://stackoverflow.com/questions/...lidation-lists

    I have the following code. It doesn't work for me though!

    Any suggestions on how to call the code?

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Loop through a data validations list and for each loop count the number of occurences


    As it's yet explained in the procedure name : ExtractDataValidationList {TheSourceRange}, {TheDestinationWorksheet} …

    Parameters between { } - including { } - must be replaced with objects expected by this procedure …

  12. #12
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Loop through a data validations list and for each loop count the number of occurences

    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.

  13. #13
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    For starters, this code is what I would like the result to be.

    How can I add VLookup in VBA to this code?

    Please Login or Register  to view this content.

    with 2 drop down list with 4 options each (option1, option2, option3, option4) I get the following output.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by waimea; 07-06-2018 at 07:00 AM.

  14. #14
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Loop through a data validations list and for each loop count the number of occurences

    Please Login or Register  to view this content.
    How can I change this code to loop through two data validation lists?

+ 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. Loop through list, add to Array, count number of occurrences, clear array
    By HalPlz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2016, 09:42 PM
  2. [SOLVED] VBA loop to copy a worksheet a number of times, assign name each time based on loop number
    By TBG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2012, 10:54 PM
  3. [SOLVED] Count number of occurrences for a number of ranges from a find loop
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-23-2012, 07:53 PM
  4. Do-While loop within a do-while loop? Dealing with changing number of rows
    By Motox in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2012, 12:59 AM
  5. VBA For loop where number of iterations can be changed from inside loop
    By barrboy89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2011, 12:18 PM
  6. Loop (Number Count)
    By PRodgers in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-19-2009, 05:56 PM
  7. [SOLVED] How to count number of occurences in an autofilter list
    By sho in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-16-2005, 08:06 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