View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jan Karel Pieterse Jan Karel Pieterse is offline
external usenet poster
 
Posts: 535
Default Selecting a group of worksheets to delete

Hi Ron,

I wish to get some code that will select and delete a group of sheets - those
that are between two other sheets "Frontsheet" and "Endsheet".


Something like this:

Option Explicit

Sub DeleteBetween()
Dim oSh As Worksheet
Dim bStart As Boolean
Application.DisplayAlerts = False
For Each oSh In ActiveWorkbook.Worksheets
If oSh.Name = "Endsheet" Then Exit For
If oSh.Name = "Frontsheet" Then
bStart = True
ElseIf bStart Then
oSh.Delete
End If
Next
Application.DisplayAlerts = True
End Sub


Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com