View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Turin[_5_] Turin[_5_] is offline
external usenet poster
 
Posts: 1
Default Loops are Great as long as they work


Hello people, Is anyone good at looping through workbooks? - im not,

I can perform a simple loop like this;

Dim wb As Workbook
Dim wbs As Workbooks

Set wbs = Application.Workbooks

For Each wb In wbs
MsgBox wb.Name
Next wb

The problem is when I replace the msgbox code with my macro it doesnt
work, or rather the problem is it works on the visible workbook then
fails to loop to any other workbooks.

I know this because my code has some handling error code that gives a
warning if you try and run the macro more than once on the same sheet.

Interestingly, If I have three workbooks open the error messgae will
appear twice indicating that VBA knows how many workbooks are open even
though it doesnt loop through them -

HELP very much appreciated - entire wont fit on here (although most of
it will be irrelevant to problem

Cheers - Greg


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