注意两者的区别:
遍历sheets
1 Sub 遍历sheets下的所有对象() 2 For Each shs In Sheets 3 k = k + 1 4 Cells(k, 1) = shs.Name 5 Next 6 End Sub
遍历worksheets
1 Sub 遍历worksheets下的所能对象() 2 For Each shs In Worksheets 3 k = k + 1 4 Cells(k, 2) = shs.Name 5 Next 6 End Sub
注意两者的区别:
遍历sheets
1 Sub 遍历sheets下的所有对象() 2 For Each shs In Sheets 3 k = k + 1 4 Cells(k, 1) = shs.Name 5 Next 6 End Sub
遍历worksheets
1 Sub 遍历worksheets下的所能对象() 2 For Each shs In Worksheets 3 k = k + 1 4 Cells(k, 2) = shs.Name 5 Next 6 End Sub