excel-vba 检索活动工作簿中的所有工作表名称
示例
Option Explicit
Sub 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
热门推荐
3 建队节祝福语简短
10 新婚祝福语致老师简短
11 六一祝贺文案祝福语简短
12 节日祝福语简短中秋暧昧
13 简短搞笑蛋糕生日祝福语
14 幼儿祝福语大全简短贺卡
15 对新人祝福语大全简短
16 业主装修完成祝福语简短
17 考进高中祝福语简短
18 生日祝福语对妈妈简短