Macro command go to last filled cell in column?

  • Thread starter Thread starter PatsyB.
  • Start date Start date
P

PatsyB.

I created a macro on the weekend that does a sort and then
is supposed to go down to the last entry in a column.
What I found this morning here at work when testing the
macro on a new spreadsheet, is that although I used the
^+down arrow which when one does it manually goes to the
last filled cell, that the macro doesn't behave the same
way. Now I might have made a mistake when recoring the
macro, though I don't think so. At any rate, here is the
macro as it stands now:
**********************************************
Sub AddNUMBER()
'
' AddNUMBER Macro
'

'
Application.Goto Reference:="R1C6"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending,
Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Application.Goto Reference:="R2C2"
Selection.End(xlDown).Select
Range("B85").Select
End Sub
**********************************************

How can I modify the above macro to go to the right spot,
the last filled entry in a column? I have all the sheets
in a workbook using the same macro so they're all going to
the same spot and that never changes, although it most
definitely should <g>!

Thank you!
 
Patsy

Sub findbottom()
Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Activate
'to get first blank below this add .Offset(1, 0) after the xlUp)
End Sub

Gord Dibben Excel MVP
 
Back
Top