PDA

View Full Version : Sleeper: Select uneven columns



lior03
07-09-2005, 10:37 AM
hello
I took advantage of johnske macro(superb as always)
I got a data from a closed workbook.
the sheet i got has no formulas only constants of i have to plant the formula again.
my question- how do i select only the "uneven" columns namely column A,C,E,G etc up to column 30 which is column bj.
thanks

Jacob Hilderbrand
07-09-2005, 12:45 PM
Try this macro.


Option Explicit

Sub SelectColumns()
Dim i As Long
Dim Rng As Range
For i = 1 To 30 Step 2
If Rng Is Nothing Then
Set Rng = Cells(1, i)
Else
Set Rng = Union(Rng, Cells(1, i))
End If
Next i
Rng.EntireColumn.Select
End Sub