M
Macro command go to last filled cell in column?
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 believe so, but 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 cell even though each sheet has different amounts
of data in it, which isn't what it should do. It should
go to the last entry in the column, just like what happens
when we press ^+down arrow.
Thank you.
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 believe so, but 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 cell even though each sheet has different amounts
of data in it, which isn't what it should do. It should
go to the last entry in the column, just like what happens
when we press ^+down arrow.
Thank you.