A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Setting up and Configuration
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro command go to last filled cell in column?



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2004, 05:03 PM
PatsyB.
external usenet poster
 
Posts: n/a
Default 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  
Old May 17th, 2004, 08:09 PM
Gord Dibben
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.