Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Add Temp Sheet after end of sheets:

https://stackoverflow.com/questions/20697706/how-to-add-a-named-sheet-at-the-end-of-all-excel-sheets

Dim sExists As Boolean
sExists = WorksheetExists("Temp")
If sExists = False Then
With ThisWorkbook
    .Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = "Temp"
    MsgBox "Creating Worksheet!"
End With
End If
    

Function WorksheetExists(sName As String) As Boolean
    WorksheetExists = Evaluate("ISREF('" & sName & "'!A1)")
End Function    

With ThisWorkbook
        .Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = "Temp"
    End With
Application.DisplayAlerts = False
Worksheets("Temp").Delete
Application.DisplayAlerts = True
    Dim sName As String
    
    sName = "temp"
    
    Worksheets.Add
    ActiveSheet.Name = sName
    
    'your code here
    
    Worksheets(sName).Delete
  • No labels