つらつら Excel VBA

私の備忘録です。

新規ブックのシート枚数を指定する

Excel2013から2019にしたら新規シートが1枚になってて驚いた。

'新規ブックのデフォルトシート枚数を1に変更してすぐ戻す

Dim newWb As Workbook
Dim sinw As Integer
sinw = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Set newWb = Workbooks.Add
Application.SheetsInNewWorkbook = sinw

以上