If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 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! |
#2
|
|||
|
|||
Macro command go to last filled cell in column?
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 On Mon, 17 May 2004 09:03:30 -0700, "PatsyB." wrote: 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! |
Thread Tools | |
Display Modes | |
|
|