Error adding a new sheet to a XLSM Macro Enabled Excel File

前端 未结 2 1489
傲寒
傲寒 2021-01-29 11:29

I want to add a new sheet in a Macro Enabled Excel File using VBA.

It doesn\'t matter the method that I use:

  • Sheets.add
  • Copying and pasting a she
2条回答
  •  -上瘾入骨i
    2021-01-29 12:28

    Try this code in your xlsm file:

    Dim ws As Worksheet
    Set ws = Sheets.Add(After:=Sheets(Sheets.Count))
    

    And let me know if this doesn't work.

提交回复
热议问题