Forum Discussion

Budman361530's avatar
Budman361530
Brass Contributor
Jul 11, 2022

Adding a new sheet macro.

So I have been using this Macro to add a sheet in a excel spreadsheet for sometime, and it works well.... 

Sub Add_New_Equipment()
'

' Add_newjobsheet Macro
'

'
Sheets("Original").Select
Sheets("Original").Copy Before:=Sheets(2)
Sheets("Equipment List").Select
End Sub

 

This is what I see on my main sheet....

Each time I click it it adds a new sheet.  In this situation, it copies the "original" and makes an "original-(2).

 

My question is... is it possible to "hide" the original sheet so you only see the copied sheet every time you click the button?  If I try to hide it now, excel gives me a "debug" window because it can't find it.  

 

 

2 Replies

  • Budman361530 

    Sub Add_New_Equipment()
        With Sheets("Original")
            .Visible = xlSheetVisible
            .Copy Before:=Sheets(2)
            .Visible = xlSheetHidden
        End With
        Sheets("Equipment List").Select
    End Sub
    • Budman361530's avatar
      Budman361530
      Brass Contributor
      Hans,
      Just had a few minutes to play with this and it works well. Thank you for the assistance.

Resources