我有15张纸,除了四张纸之外,我需要遍历所有纸,分别是图形,打印,摘要和打印。
我的代码只排除了第一张纸,而没有另外三张纸。
Dim Current As Worksheet
For Each Current In Worksheets
If Current.Name <> "Summary" And Current.Name <> "Model" And Current.Name <> "Print" And Current.Name <> "Graphs" Then
MsgBox Current.Name
Next
End Sub
我希望能够排除输出中的四张纸。 TIA
答案 0 :(得分:0)
这应该有效:
bar
答案 1 :(得分:-2)
Sub Sheets_Walk()
Dim ws As Worksheet
For Each ws In Worksheets
If s_in_A1(ws.Name, a1_Names) = False Then
MsgBox ws.Name
End If
Next
End Sub
Function s_in_A1( _
s As String, _
a1 As Variant) _
As Boolean
Dim lCol As Long
For lCol = LBound(a1) To UBound(a1)
If a1(lCol) = s Then
s_in_A1 = True
Exit For
End If
Next
End Function
Function a1_Names() _
As Variant
a1_Names = Array("Summary", "Model", "Print", "Graphs")
End Function