View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Grouping and moving worksheets by name using VBA?

Dim bReplace As Boolean, sh As Worksheet
Dim bk As Workbook
bReplace = True
For Each sh In Worksheets
If sh.Name Like "*Today" Then
sh.Select Replace:=bDontReplace
bReplace = False
End If
Next
ActiveWindow.SelectedSheets.Move
ActiveWorkbook.SaveAs Filename:=bk.Path & "\" & "Today.xls"

--
Regards,
Tom Ogilvy

"Simon Lloyd"
wrote in message
...

Hi all,
Is it possible to group sheets ending with a certain name and move them
to a new workbook in my documents named by the name i am grouping by?
Lets say i have 20 sheets each named "**** Today" where **** is a
variable, is it possible in VBA to group all the sheets with name
ending in Today and move them to a new workbook in my documents and
name the workbook "Today"?

Hope you can help!

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile:

http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=546346