View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Need help setting a range

Hi,

Try this (Untested!)

Sub SetRange()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("a1:a" & lastrow)
For col = 3 To 55 Step 2
Set rng = Union(rng, Range(Cells(1, col), Cells(lastrow, col)))
Next col

End Sub

HTH

"GettingThere" wrote:

I'm trying to set a range where the row range is:

"A2:A" & lstRow ' where lstRow = Range("A" & Rows.Count).End(xlUp).Row

and the columns range is the odd numbered columns in A:BC.

Do I need to use Intersect? I'm stumped!

Thanks in advance!