+ Reply to Thread
Results 1 to 2 of 2

Workbook Loop Headache

  1. #1
    Registered User
    Join Date
    07-07-2005
    Posts
    7

    Question Workbook Loop Headache

    Hello all,

    I have an issue which no matter what I try I can't resolve. In my accounts departments we download up to 80 reports every month end.

    I have a macro which formats each one into its correct format with dates and titles etc. This works perfectly and I dont think I really need to post it here.

    When I try to add code to this which would make it loop through all the workbooks I have open it fails - no matter what I try. If I did wach workbook individually it work every time.

    Does anyone know of any code that would loop my macro though all open workbooks in excel???

    Any help - much appreciated, although I have tried most of the techniques I have found in help sites etc, I think I may be making a stupid oversight although I have no code left to show you what I did in the first place.

    Cheers Greg

  2. #2
    Dick Kusleika
    Guest

    Re: Workbook Loop Headache

    Turin

    What do you mean by "fail". If you get an error, post what error you get.
    You're probably trying to do something to a workbook that you can't do
    because it's an Add-in or a hidden workbook. This may alleviate your
    problems

    Dim wb As Workbook

    For Each wb In Application.Workbooks
    If wb.Visible = True
    'Do stuff
    End If
    Next wb

    --
    **** Kusleika
    Excel MVP
    Daily Dose of Excel
    www.*****-blog.com

    Turin wrote:
    > Hello all,
    >
    > I have an issue which no matter what I try I can't resolve. In my
    > accounts departments we download up to 80 reports every month end.
    >
    > I have a macro which formats each one into its correct format with
    > dates and titles etc. This works perfectly and I dont think I really
    > need to post it here.
    >
    > When I try to add code to this which would make it loop through all
    > the workbooks I have open it fails - no matter what I try. If I did
    > wach workbook individually it work every time.
    >
    > Does anyone know of any code that would loop my macro though all open
    > workbooks in excel???
    >
    > Any help - much appreciated, although I have tried most of the
    > techniques I have found in help sites etc, I think I may be making a
    > stupid oversight although I have no code left to show you what I did
    > in the first place.
    >
    > Cheers Greg




+ 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