以下代码一直有效,直到表格代码模板为VeryHidden。请帮忙!!
y = ActiveWorkbook.Worksheets.Count
namePrompt = InputBox("Enter a name for the new sheet", "Add Sheet")
If namePrompt = "" Then Exit Sub
Template.Copy after:=Worksheets(y - 1)
ActiveSheet.Name = namePrompt
答案 0 :(得分:0)
您可以测试该表是否为VeryHidden,如果是,您可以在复制前取消隐藏...
Sub Tester()
Dim y, namePrompt, wasHidden
y = ActiveWorkbook.Worksheets.Count
namePrompt = InputBox("Enter a name for the new sheet", "Add Sheet")
If namePrompt = "" Then Exit Sub
Application.ScreenUpdating = False
If Template.Visible = xlSheetVeryHidden Then
Template.Visible = xlSheetVisible
wasHidden = True
End If
Template.Copy after:=Worksheets(y - 1)
ActiveSheet.Name = namePrompt
If wasHidden Then Template.Visible = xlSheetVeryHidden
End Sub