excel-vba 检索活动工作簿中的所有工作表名称
示例
Option ExplicitSub LoopAllSheets()
Dim sht As Excel.Worksheet
' declare an array of type String without committing to maximum number of members
Dim sht_Name() As String
Dim i As Integer
' get the number of worksheets in Active Workbook , and put it as the maximum number of members in the array
ReDim sht_Name(1 To ActiveWorkbook.Worksheets.count)
i = 1
' loop through all worksheets in Active Workbook
For Each sht In ActiveWorkbook.Worksheets
sht_Name(i) =sht.Name' get the name of each worksheet and save it in the array
i = i + 1
Next sht
End Sub
以上是 excel-vba 检索活动工作簿中的所有工作表名称 的全部内容, 来源链接: utcz.com/z/321271.html