LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic question about multi sheet workbooks JOUIOUI Excel Discussion (Misc queries) 2 June 28th 06 08:07 PM
Stop the prompt to save when closing workbooks Rebecca Potter Excel Discussion (Misc queries) 1 December 2nd 05 10:00 AM
Can Multi WorkBooks Be combined in One Pivot Table? dallin Excel Discussion (Misc queries) 0 September 28th 05 03:47 PM
Workbooks...I'll try this again... Markster Excel Discussion (Misc queries) 10 December 7th 04 10:12 PM
Getting multi workbooks to talk Rj Excel Discussion (Misc queries) 2 December 1st 04 03:53 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"