**这是为列 M 提供这些名称(sht1-sht9)排除的 sheetNames 的代码::
Public Sub Worksheet_Activate()
Const sht1 As String = "Main-test"
Const sht2 As String = "Data-list"
Const sht3 As String = "Report"
Const sht4 As String = "EmpList"
Const sht5 As String = "emp_intface"
Const sht6 As String = "sample"
Const sht7 As String = "SSSSSS"
Const sht8 As String = "log"
Const sht9 As String = "Report2"
Range("m:m").ClearContents
Dim S As Integer
For S = 1 To Worksheets.Count
With Worksheets("Report2")
Set ws = Worksheets(S)
If ws.Visible = True And _
(ws.Name <> sht1) And (ws.Name <> sht2) And (ws.Name <> sht3) And (ws.Name <> sht5) And _
(ws.Name <> sht4) And (ws.Name <> sht6) And (ws.Name <> sht7) And (ws.Name <> sht8) _
And (ws.Name <> sht9) Then
.Cells(S, 13).Value = ws.Name
End If
End With
Next
End Sub
* *更多详细信息来解释我的问题:
所以这些排除的SheetNames首先开始,然后其余的工作表在排除的工作表之后的最后一个顺序出现,所以当这段代码运行时,它会在M列中创建一些空白行;因为工作表的顺序已被排除,那么解决方案是什么将 SHeetNames 从第 10 行或第 11 行移动到 M 列中的第一个空白行???`