excel VBA中如何提取没有被隐藏的工作表的名称?
发布网友
发布时间:2022-04-21 02:57
我来回答
共1个回答
热心网友
时间:2023-11-04 20:15
在当前工作表的A列生成结果:
Sub test()
Dim ar(1 To 100, 1 To 1)
Dim i As Long, j As Long
For i = 1 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
j = j + 1
ar(j, 1) = Sheets(i).Name
End If
Next i
With ActiveSheet.Cells(1, 1)
.Resize(Rows.Count).ClearContents
.Resize(j) = ar
End With
End Sub
hx95华夏联盟