How to select all sheets in front of a particular sheet???
Sub AC()
Dim bk2 as Workbook, sh as Worksheet
set bk2 = Workbooks("OtherBookd.xls")
Worksheets(1).Select
For Each sh In Worksheets
If LCase(sh.Name) < "raw data" Then
sh.Select False
Else
Exit For
End If
Next
ActiveWindow.SelectedSheets.Move After:=Bk2.Worksheets(bk2.Worksheets.count)
Thisworkbook.Select
ThisWorkbook.Worksheets(1).Select
End Sub
--
Regards,
Tom Ogilvy
"Jac" wrote:
Hi,
I have files which the sheets are structured in such a way as below:-
2009 2006 2005 2004 2003 2002 1990 Raw Data
Is there any way that I can use macro to select all the sheets placed in
front of Raw Data sheet and move it to a new file???
I have tried to record a macro to do so but all the sheet's names are being
specified in the code which made the macro not flexible; cause the sheets may
have been named with different years!!
Anyone has any solution; please advice....
Thanking in advance!!
|