Thread: Creteria Help
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Creteria Help

Hi
I forgot to insert the AddSheet macro, so it did well to work!

Public Sub AddSheet(TheSheetName As String)
Dim wsNew As Worksheet 'we will insert a fresh worksheet
With ActiveWorkbook
On Error Resume Next
Application.DisplayAlerts = False
.Worksheets(TheSheetName).Delete
On Error GoTo 0
Application.DisplayAlerts = True
'If worksheet is not there the error in deletion is ignored
'Add a new sheet
Set wsNew = .Worksheets.Add(after:=Worksheets("Panel Details"))
'Makes wsNew the active sheet
wsNew.Name = TheSheetName
End With
Set wsNew = Nothing
End Sub

regards
Paul