是否可以复制并重命名隐藏的工作表?
我已经如下创建了宏
Sub Copyandrename()
'
' Copyandrename Macro
'
'
Sheets("Template").Copy Before:=Sheets(1)
Sheets("Template (2)").Name = "Issues and Key Takeaways"
Rows("6:6").Select
Range("C6").Activate
Selection.AutoFilter
ActiveWorkbook.Worksheets("Issues and Key Takeaways").AutoFilter.Sort. _
SortFields.Clear
ActiveWorkbook.Worksheets("Issues and Key Takeaways").AutoFilter.Sort. _
SortFields.Add Key:=Range("C6"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Issues and Key Takeaways").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("D9").Select
End Sub
但是,一旦我隐藏“模板”标签,就会收到以下错误消息。
运行时错误“ 91”:
对象变量或未设置块变量
是否有解决此问题的建议?