批量選中所有奇數(shù)列(Excel VBA)
Sub 選擇奇數(shù)列()
Dim a As Range
Dim i, n
i = Application.CountA(Rows(1))
'i用第一行判斷內(nèi)容有多少列
For n = 1 To i Step 2 '步長2保證奇數(shù)全部union
If a Is Nothing Then
Set a = Columns(1)
Else
Set a = Union(a, Columns(n))
End If
Next
a.Select
End Sub