New to excel macros need help with selecting ranges

  • Thread starter Thread starter irishiii75
  • Start date Start date
I

irishiii75

I have need a macro that will select a range in a column and copy
data.
In one spreadsheet the column range maybe N2 - N15
the next time the column range maybe N2 - N250

How can I code it to select N2 - last cell in column so I don't have
to change macro each time for each spreadsheet.

Thank you

Terrie
 
Hi,

Try this

lastrow = Cells(Rows.Count, "N").End(xlUp).Row
Range("N2:N" & lastrow).Select

Mike
 
How about a nice one liner broken up to account for possible word wrap. NO
selections

Sub copyrng()
Cells(2, 4).Resize(Cells(Rows.Count, 4). _
End(xlUp).Row - 1).Copy range("z5")
End Sub
 
How about a nice one liner broken up to account for possible word wrap. NO
selections

Sub copyrng()
Cells(2, 4).Resize(Cells(Rows.Count, 4). _
  End(xlUp).Row - 1).Copy range("z5")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software








- Show quoted text -


Thank you all for your help. Your information pointed me in the
direction to accomplish my selection.
 
Glad to help. However, it is not necessary to SELECT. Post your code for
comments.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
How about a nice one liner broken up to account for possible word wrap. NO
selections

Sub copyrng()
Cells(2, 4).Resize(Cells(Rows.Count, 4). _
End(xlUp).Row - 1).Copy range("z5")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software








- Show quoted text -


Thank you all for your help. Your information pointed me in the
direction to accomplish my selection.
 
Back
Top