ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select all tabs after a certain tab (https://www.excelbanter.com/excel-programming/438587-select-all-tabs-after-certain-tab.html)

JohnUK

Select all tabs after a certain tab
 
Hi, Many thanks to Ryan for help on Deleting tabs.
I am now after a way of selecting all tabs regardless of amount after a
certain tab.
The reason for this, is so that I can copy to a new workbook.
Again, many thanks for help

Bernie Deitrick

Select all tabs after a certain tab
 
John,

The macro below will copy sheets from the activesheet to a new workbook.

HTH,
Bernie
MS Excel MVP

Sub SelectFromCurrentSheet2End()
Dim i As Integer
'if multiple sheet are selected, just select the activesheet to start
ActiveSheet.Select True
For i = ActiveSheet.Index To Sheets.Count
Sheets(i).Select False
Next i
ActiveWindow.SelectedSheets.Copy 'Create the new workbook
End Sub

"JohnUK" wrote in message
...
Hi, Many thanks to Ryan for help on Deleting tabs.
I am now after a way of selecting all tabs regardless of amount after a
certain tab.
The reason for this, is so that I can copy to a new workbook.
Again, many thanks for help




Bernie Deitrick

Select all tabs after a certain tab
 
Oops - left out some of my explanation:
The macro below will copy sheets, from the activesheet to the last sheet, to a new workbook.

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
John,

The macro below will copy sheets from the activesheet to a new workbook.

HTH,
Bernie
MS Excel MVP

Sub SelectFromCurrentSheet2End()
Dim i As Integer
'if multiple sheet are selected, just select the activesheet to start
ActiveSheet.Select True
For i = ActiveSheet.Index To Sheets.Count
Sheets(i).Select False
Next i
ActiveWindow.SelectedSheets.Copy 'Create the new workbook
End Sub

"JohnUK" wrote in message
...
Hi, Many thanks to Ryan for help on Deleting tabs.
I am now after a way of selecting all tabs regardless of amount after a
certain tab.
The reason for this, is so that I can copy to a new workbook.
Again, many thanks for help






Per Jessen

Select all tabs after a certain tab
 
Hi

Look at this:

Sub CopyTabs()
Dim ShArr()

AfterSh = Worksheets("Sheet3").Index
NumOfShToCopy = Worksheets.Count - AfterSh
ReDim ShArr(1 To NumOfShToCopy)
For Sh = 1 To NumOfShToCopy
ShArr(Sh) = Worksheets(Sh + AfterSh).Name
Next
Sheets(ShArr).Copy
End Sub

Regards,
Per

"JohnUK" skrev i meddelelsen
...
Hi, Many thanks to Ryan for help on Deleting tabs.
I am now after a way of selecting all tabs regardless of amount after a
certain tab.
The reason for this, is so that I can copy to a new workbook.
Again, many thanks for help




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com