- 新增表单
Sub AddNewsheet() Sheets.AddEnd Sub
Sub AddNewSheet2() '若有同名的sheet已经存在时,使用该种方法添加表单,会报错 Sheets.Add.Name = "NewSheet2"End Sub
- 修改表单名称
Sub RenameSheet() Sheets("Sheet23").Select Sheets("Sheet23").Name = "NewName"End Sub
- 删除表单
Sub DeleteSheet() Application.DisplayAlerts = False Sheets("NewName").Delete Application.DisplayAlerts = TrueEnd Sub
- 获取当前工作簿中所有表单的名称
Sub GetAllSheetsname() Dim sheet As Object For Each sheet In ThisWorkbook.Worksheets Debug.Print sheet.Name NextEnd Sub
- 获取当前工作簿中表单数量
Sub SheetCounts() Debug.Print Sheets.CountEnd Sub
- 复制表单