So technically the following code is working:
The actual sub is this:
I have only one sheet in the workbook before i click my button, a sheet is added with the correct name but it is sheet3... If i run just the sub it creates it as sheet2.. something about using the button i assume?
here is the code for the delete sheet process:
Any help would be much appreciated.
Code:
Private Sub CommandButton1_Click()
Create_Sheet
Import_All_Branches
Delete_Sheet
End Sub
Code:
Sub Create_Sheet()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets.Add(After:= _
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
ws.Name = "Single Branch Open Order Detail"
End Sub
I have only one sheet in the workbook before i click my button, a sheet is added with the correct name but it is sheet3... If i run just the sub it creates it as sheet2.. something about using the button i assume?
here is the code for the delete sheet process:
Code:
Sub Delete_Sheet()
Application.DisplayAlerts = False
Sheets(2).Delete
Application.DisplayAlerts = True
End Sub
Last edited: