Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loops are Great as long as they work
Hi Greg.
Please post your contentious code. --- Regards, Norman "Turin" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loops are Great as long as they work
Hope this helps - thanks for the reply Had to send it as an attachment - dont know whether it will work, Let me know what you think.... Thanks again +-------------------------------------------------------------------+ |Filename: wkbook loop code.doc | |Download: http://www.excelforum.com/attachment.php?postid=3805 | +-------------------------------------------------------------------+ -- Turin ------------------------------------------------------------------------ Turin's Profile: http://www.excelforum.com/member.php...o&userid=24987 View this thread: http://www.excelforum.com/showthread...hreadid=466535 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loops are Great as long as they work
Hi Turin,
Just copy / paste the code. With good reason, few in this group would be prepared to open attachments. Therefore, if you post the code, you will significantly improve the probability of effective assistance. --- Regards, Norman "Turin" wrote in message ... Hope this helps - thanks for the reply Had to send it as an attachment - dont know whether it will work, Let me know what you think.... Thanks again +-------------------------------------------------------------------+ |Filename: wkbook loop code.doc | |Download: http://www.excelforum.com/attachment.php?postid=3805 | +-------------------------------------------------------------------+ -- Turin ------------------------------------------------------------------------ Turin's Profile: http://www.excelforum.com/member.php...o&userid=24987 View this thread: http://www.excelforum.com/showthread...hreadid=466535 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loops are Great as long as they work
Sorry, I tried to post the code but the forum says it is too big to fit o here. Not sure I can trim it down either as this may remove the isuue that i causing the problem to the loop????? For what is worth, I can gurantee that the attachment is not dodgy, i is just a .doc file. Other than the attachment dont see how I can actually get it too you i its entirety. Could the problem be a general one? for example, could the code caus problems to the loop as it uses multiple loops and if statements Something like that? I otherwords is there anything that a wkbook loop doesnt like t occur??? Regards Gre -- Turi ----------------------------------------------------------------------- Turin's Profile: http://www.excelforum.com/member.php...fo&userid=2498 View this thread: http://www.excelforum.com/showthread.php?threadid=46653 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
Long Long Long Nested If Function | Excel Discussion (Misc queries) | |||
THIS IS A GREAT SITE! THANK YOU!!!! | Excel Discussion (Misc queries) | |||
why won't vlookup work in a long list | Excel Worksheet Functions | |||
Great discovery? | Excel Worksheet Functions |