EXCEL VBA 在for循环中怎么跳过指定sheet? excel VBA,如果循环for i =1 to 30,我...

excel vba\u5982\u4f55\u8ba9\u6240\u6709\u5de5\u4f5c\u7c3f\u8868\u90fd\u8fd0\u884c\u4ee3\u7801\uff08\u8df3\u8fc7\u67d0\u4e2a\uff09\uff1f\u6c42\u4fee\u6539

\u4ee3\u7801\u52a0\u4e2a\u6761\u4ef6\u5c31\u597d\u4e86
Sub WorksheetLoop2()Dim Current As WorksheetDim Row0 As Long, Row1 As LongFor Each Current In Worksheetsif Current.index>2 then '\u5982\u679c\u5de5\u4f5c\u8868 \u5728\u7b2c2\u4e2a\u5de5\u4f5c\u8868\u4e4b\u540e\uff08\u6309\u663e\u793a\u987a\u5e8f\uff09With CurrentRow0 = .Cells(1048576, 1).End(xlUp).Row.UsedRange.RemoveDuplicates Columns:=Array(8, 9, 10), Header:=xlYeRow1 = .Cells(1048576, 1).End(xlUp).RowEnd WithMsgBox Current.Name & Row0 - Row1, vbInformation, "Information"end ifNextEnd Sub

dim A1 as Object, fileb as string
fileb=thisworkbook.path & "\B.xls"
workbooks.open fileb
For Each A1 In sheet1.Controls
\u6ca1\u6709\u6307\u5b9aA1\u5177\u4f53\u662f\u4ec0\u4e48\u5bf9\u8c61
me\u6307\u81ea\u5df1
me.controls
\u5e94\u8be5\u81ea\u8eab\u7684controls

sub text ()
Dim a
For a = 1 To 30
if a<>1 and a<>3 and a<>6 and a<>8 then
Sheets(a).Activate
Range("G3).Copy Range("F3")
end if
next
end sub

Sub text()
Dim a, m As String
For a = 1 To 30
m = Sheets(a).Name
If m <> "sheet1" And m <> "sheet3" And m <> "sheet6" And m <> "sheet8" Then
Sheets(a).Activate
Range("G3").Copy Range("F3")
End If
Next
End Sub

扩展阅读:java ... excel vba dir ... vba编程必背50个程序 ... vba case ... microsoft visio ... vba中断for循环 ... python vba ... vba入门实例 ... excel vba find ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网