View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Selecting a variable range

dim wks as worksheet
dim myRng as Range
dim LastRow as long

set wks = worksheets("Sheet1")
with wks
lastrow = .cells(.rows.count,"A").end(xlup).row
set myrng = .range("a6:M" & lastrow)
'more stuff
end with

I stopped with column M. Was that 13 to the right?

Bill wrote:

I am trying to select a range starting with A6 and ending with the last entry
in column A and including 13 columns to the right. I have the code below,
but it doesn't work. The last line the containg the range "A6:LwrRight"
doesn't work. I think it's because I'm using a range where a cell reference
is needed. Any Help. Thanks
Bill

Private Sub

Dim LwrRight As Range
Range("A6").Select
'Range(Selection, Selection.End(xlDown)).Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 13).Activate
Set LwrRight = ActiveCell
Range("A6:LwrRight").Select

End Sub


--

Dave Peterson