ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook Loop Headache (https://www.excelbanter.com/excel-programming/338099-workbook-loop-headache.html)

Turin[_4_]

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


--
Turin
------------------------------------------------------------------------
Turin's Profile: http://www.excelforum.com/member.php...o&userid=24987
View this thread: http://www.excelforum.com/showthread...hreadid=398341


Dick Kusleika[_4_]

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





All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com