View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default 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

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-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