+ Reply to Thread
Results 1 to 4 of 4

Vba to connect 3 macros to loop through datavalidation list

  1. #1
    Registered User
    Join Date
    01-05-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2016
    Posts
    49

    Vba to connect 3 macros to loop through datavalidation list

    Hi

    i have small problem with huge excel file, which have to be calculated. I have drop-down data validation list in cell C3 and I want it to create macro which will connect macros already written and working well. I wanna macro that will run all three process written in code bellow and then select next name from drop-down list and repeat whole process


    Process I imagined is in this order

    1st macro
    Please Login or Register  to view this content.
    2nd macro
    Please Login or Register  to view this content.

    3rd and last macro

    Please Login or Register  to view this content.

    and after that macro select next one from data validation list and repeat whole process till the end of dropdown list in cell c3.

    any idea how to do that ?
    Last edited by joezzz; 09-09-2018 at 11:31 AM.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Vba to connect 3 macros to loop through datavalidation list

    What does this data validation list look like ?
    According to this scheme (see image below): "A; B; C; D; E; F; G", etc. ?
    Or something different: range, variable, etc. ?

    Can you include an example ?
    Attached Images Attached Images

  3. #3
    Registered User
    Join Date
    01-05-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2016
    Posts
    49

    Re: Vba to connect 3 macros to loop through datavalidation list

    last macro wont work because it copy results to another workbook. See example file


    i want from macro to work on sheet "IzracunPOV"
    There are 3 dependent data validation list and i want just last one in cell C3 to loop through whole list and run all macros listed above.
    In sample file there are macro assigned to button

    I want that when i select for example "Zelje za svežo porabo 1" and run macro that macro will follow process listed above (Shortly: 1st clear, 2nd fill data and lastone copy to another workbook) and when is
    first from that list done, macro will continue with next on the list "Zelje za svežo porabo 2" and so on.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Vba to connect 3 macros to loop through datavalidation list

    Firstly:
    Correct some of your procedures and check if they will work correctly after the code has been corrected:

    1. Change your existing 'CommandButton3_Click' to:
    Please Login or Register  to view this content.
    where 'macro_1' (below) should be placed in a module, e.g. 'Module1, Module2', etc.:
    Please Login or Register  to view this content.
    2. Change your existing 'CommandButton4_Click' to:
    Please Login or Register  to view this content.
    where 'macro_2' (below) should be corrected and placed in a module, e.g. 'Module1, Module2', etc. (together with 'macro_1'):
    Please Login or Register  to view this content.
    3. Change your existing 'CommandButton1_Click' to:
    Please Login or Register  to view this content.
    where 'macro_3' (below) should be corrected and placed in a module, e.g. 'Module1, Module2', etc. (together with 'macro_1' and 'macro_2'):
    Please Login or Register  to view this content.
    In this way, you will be able to use macros independently of each other if necessary (either by buttons or otherwise).

    Secondly:
    Change your existing 'Function dobiPodatke' (in Class Modules) to:
    Please Login or Register  to view this content.
    The changes are cursory and should not affect the action/working of macros.

    Thirdly:
    After the above, if everything will work, place following procedures in the 'Sheet10(IzracunPOV)' module and try:

    Please Login or Register  to view this content.
    An important issue:
    On sheet 'Baza', starting from column 'N', there must be one row of space between the last elements of lists in columns and other data.

+ 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] Datavalidation custom list
    By Jacc in forum Excel General
    Replies: 3
    Last Post: 02-28-2017, 07:10 AM
  2. Create DataValidation List with two cell condition
    By turist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2014, 08:36 AM
  3. ADD VALUES AT TOP OF THE List in datavalidation cell
    By kumari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2013, 07:03 AM
  4. [SOLVED] How to use VBA so that a list box, not DataValidation pops up
    By marksm33 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2013, 02:05 PM
  5. Replies: 4
    Last Post: 07-11-2012, 03:29 PM
  6. Display ChartObject from a datavalidation list
    By bktong in forum Excel General
    Replies: 1
    Last Post: 02-05-2011, 06:34 AM
  7. problem with Formating the DataValidation List
    By appunu in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-31-2010, 06:13 PM

Tags for this Thread

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