Select all tabs after a certain tab

J

JohnUK

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
 
B

Bernie Deitrick

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
 
B

Bernie Deitrick

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
 
P

Per Jessen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top