![]() |
closing multi workbooks
first, thanks to anyone who helps out w/ this..i've tried a couple of different things, and just keep messing up my macro...so as simple as it may be, i bring nothing to the table here.... I have up to 50 workbooks named 'rec 1', 'rec 2' etc.... I run a macro to move specified sheets to a new wbk called 'rec indi' after all the moves how do I close all of the 'rec' files ? what syntax is used to replace ("BOOK1.XLS")??? to close all rec files? Application.DisplayAlerts = False Workbooks("BOOK1.XLS").Close Application.DisplayAlerts = True -- have_a_cup ------------------------------------------------------------------------ have_a_cup's Profile: http://www.excelforum.com/member.php...o&userid=35394 View this thread: http://www.excelforum.com/showthread...hreadid=556561 |
closing multi workbooks
Try this:
For Each Workbook In Workbooks If Left(Workbook.Name, 3) = "rec" Then Workbook.Close End If Next -Simon "have_a_cup" wrote: first, thanks to anyone who helps out w/ this..i've tried a couple of different things, and just keep messing up my macro...so as simple as it may be, i bring nothing to the table here.... I have up to 50 workbooks named 'rec 1', 'rec 2' etc.... I run a macro to move specified sheets to a new wbk called 'rec indi' after all the moves how do I close all of the 'rec' files ? what syntax is used to replace ("BOOK1.XLS")??? to close all rec files? Application.DisplayAlerts = False Workbooks("BOOK1.XLS").Close Application.DisplayAlerts = True -- have_a_cup ------------------------------------------------------------------------ have_a_cup's Profile: http://www.excelforum.com/member.php...o&userid=35394 View this thread: http://www.excelforum.com/showthread...hreadid=556561 |
closing multi workbooks
great...thanks SimonCC....worked like a charm....off to make more of a confused state on my project.... -- have_a_cup ------------------------------------------------------------------------ have_a_cup's Profile: http://www.excelforum.com/member.php...o&userid=35394 View this thread: http://www.excelforum.com/showthread...hreadid=556561 |
All times are GMT +1. The time now is 09:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com