示例
:
Dim
SX
As
Range,
aR
As
Range,
r
As
Range,
bt
As
Integer
'篩選區域變量
Sub
test()
Set
SX
=
ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTypeVisible)
For
Each
aR
In
SX.Areas
'逐個連續區域
For
Each
r
In
aR.Rows
'逐行
If
bt
Then
'處理自動篩選出的行,用r.Cells(1,
2)引用r行的第2列
Else
'跳過標題行
bt
=
1
End
If
Next
Next
End
Sub