View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
SimonCC
 
Posts: n/a
Default 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