PDA

View Full Version : select A2 through the last used cell in a column



mduff
04-14-2009, 07:52 PM
Hi I am trying to have a code select all the used cells in a specific columns the data may have data missing in some rows but then continues and the amount of rows is dynamic (can change)

I used the macro recorder and it gave me this the issue is that the column may have blank rows in then the data continues

Sheets("RAW").Select
Range("E2").Select
Range(Selection, Selection.End(xlDown)).Select

I found this code but it copying everything from P2 on etc

With ActiveSheet
.Range("P2", .Cells.SpecialCells(xlCellTypeLastCell)).Select
End With

any help would be apricated

joms
04-14-2009, 08:55 PM
hi mduff, don't know if this is what you mean.. please check below.


Sub Q()
Sheets("RAW").Select
Range("E2").Select
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

MsgBox lastrow
End Sub