Having trouble adding a new worksheet in excel '10. Old code use to work. keep getting error 13, type mismatch. Program is to create a blank sheet1 and hide all other sheets.
Sub Hide_Sheets()
Dim ws As Worksheet
'Statement steps through each worksheet making them invisible
'leaving sheet1 visible.
Set newsheet = Worksheets.Add
newsheet.Name = "Sheet1"
For Each ws In ThisWorkbook.Worksheets
If ws.Name = "Sheet1" Then
ws.Visible = True
Else: ws.Visible = xlSheetVeryHidden
End If
Next ws
End Sub
Sub Hide_Sheets()
Dim ws As Worksheet
'Statement steps through each worksheet making them invisible
'leaving sheet1 visible.
Set newsheet = Worksheets.Add
newsheet.Name = "Sheet1"
For Each ws In ThisWorkbook.Worksheets
If ws.Name = "Sheet1" Then
ws.Visible = True
Else: ws.Visible = xlSheetVeryHidden
End If
Next ws
End Sub