+ Reply to Thread
Results 1 to 4 of 4

Problem looping thru worksheets in a workbook..

  1. #1
    Registered User
    Join Date
    07-07-2015
    Location
    Wash DC
    MS-Off Ver
    10
    Posts
    57

    Problem looping thru worksheets in a workbook..

    Issue with an inherited Excel Macro - where original conditions have changed ...

    The current workbook imports a handful of *.csv where each .csv gets it's own worksheet.. There is a master sheet that already exists that is designed to pull in the data from these separate or individual worksheets after the fact...

    However do to a change in process has resulted in a variation of the *.csv file names .. So now when the script runs to pull in data if the worksheet doesn't exist - it pops open a explorer box to find a document... Ack

    This is the script
    Please Login or Register  to view this content.
    ...

    The files used to be just "Batch" and there used to always be 4 of them, However, the total number has changes - up to 16 different types, where not all the files in the range get delivered on occasion

    Batch1a_GETS
    Batch1b_GETS
    Batch2a_GETS
    Batch2b_GETS

    down thru Batch8b_GETS....
    (basically 1-8, each with an A & B in the name)

    The issue that depending how program is run that generates the *.csv files are run it's possible get Batch 1 thru 4 or just Odd numbers - or some odd combination, I don't always get ALL the files referenced in the macro... The problem is that if say Batch2 doesn't exist (ie both Batch2a_GETS & Batch2b_GETS - it attempts to open a file dialog box..

    I've been working on trying to do some equivalent of if not exist or to loop the separate commands (since the R1C1 now) - so that it won't choke if the files doesn't exist - but am stuck
    Last edited by Hondahawkrider; 09-23-2015 at 03:13 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: Problem looping thru worksheets in a workbook..

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    07-07-2015
    Location
    Wash DC
    MS-Off Ver
    10
    Posts
    57

    Re: Problem looping thru worksheets in a workbook..

    Fixed to satisfy rules

  4. #4
    Registered User
    Join Date
    07-07-2015
    Location
    Wash DC
    MS-Off Ver
    10
    Posts
    57

    Re: Problem looping thru worksheets in a workbook..

    anyone, I could use some input if anyone knows

+ 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] Problem looping through worksheets
    By vexel77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 11:50 AM
  2. Macro looping through several worksheets in one workbook
    By awcwa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2013, 05:26 PM
  3. [SOLVED] Macro Wanted for looping thru worksheets in one workbook and pasting to another workbook!!
    By eduardito in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-03-2012, 07:43 AM
  4. Looping and pasting worksheets into new workbook, error part way through
    By yerromnitsuj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 02:26 AM
  5. Looping accross all worksheets in a workbook
    By gspencer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2011, 04:06 PM
  6. Looping through worksheets in a workbook to pull data
    By fecurtis in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2008, 01:40 PM
  7. Workbook looping to many worksheets
    By L. Howard Kittle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2006, 05:10 PM
  8. Looping worksheets in workbook
    By Wylie C in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2005, 05: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