Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 252
Default Locate last cell in column

I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Locate last cell in column

Maybe

Lastrow = Range("A65536").End(xlUp).Row

Mike

"Sloth" wrote:

I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Locate last cell in column

hi
can you get to it from the bottom.
MsgBox Cells(Rows.Count, "a").End(xlUp).Row

regards
FSt1

"Sloth" wrote:

I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David

  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Locate last cell in column

Here's a little macro to do it.

Sub LastRowColumnA()
Dim lastrow
Application.Goto Reference:="R65536C1"
Selection.End(xlUp).Select
lastrow = ActiveCell.Row
MsgBox "The last row in column A is Row " & lastrow
End Sub


Vaya con Dios,
Chuck, CABGx3



"Sloth" wrote:

I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Locate last cell in column

I may have misunderstood and assumed VB so try this if you want a formula.
It's an array so enter with CTRL+Shift+Enter

=ROW(INDIRECT("A"&MAX(IF(NOT(ISBLANK(A1:A65535)),R OW(1:65535)))))

Mike

"Sloth" wrote:

I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Locate last cell in column

Try this *array* formula:

=MAX(IF(1-ISBLANK(A1:A1000),ROW(A1:A1000)))

--
Array formulas are entered using CSE, <Ctrl <Shift <Enter, instead of the
regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually. Also, CSE *must* be used when
revising the formula.


You *can't* use total column references (A:A) in array formulas unless
you're using XL07!


HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

"Sloth" wrote in message
...
I need to find the row number of the last cell in column A:A. Column A:A
contains many gaps, and the data is a mixture of dates and text.

For Example: The formula should return 10 for the following data.
1/21/2006
David

Sam
Paul

2/5/2008
Fred

David


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 252
Default Locate last cell in column

Well I should have asked what I really wanted to begin with. I want to
delete the bottom 10 rows of my sheet with a macro. I thought I could figure
it out myself, but I can't get the syntax right.

"Mike H" wrote:

Maybe

Lastrow = Range("A65536").End(xlUp).Row

Mike

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Locate last cell in column

Often a good idea to ask what you want <g try this

Sub substance()
Range("A65536").End(xlUp).Offset(-9, 0).Select
Set destrange = ActiveCell.Resize(10, 1)
destrange.ClearContents
End Sub
Mike

"Sloth" wrote:

Well I should have asked what I really wanted to begin with. I want to
delete the bottom 10 rows of my sheet with a macro. I thought I could figure
it out myself, but I can't get the syntax right.

"Mike H" wrote:

Maybe

Lastrow = Range("A65536").End(xlUp).Row

Mike

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 252
Default Locate last cell in column

I finally got it. Thanks everyone. Mike your macro deletes the last 10
cells in column A, not the rows. Thanks for helping though (I used your
first suggestion)!!! The following is the code I used.

lastrow = Range("A65536").End(xlUp).Row
Rows(lastrow - 10 & ":" & lastrow).Delete


"Mike H" wrote:

Often a good idea to ask what you want <g try this

Sub substance()
Range("A65536").End(xlUp).Offset(-9, 0).Select
Set destrange = ActiveCell.Resize(10, 1)
destrange.ClearContents
End Sub
Mike

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to locate a cell jhyatt Excel Discussion (Misc queries) 2 October 9th 07 09:06 PM
Locate a specific row or column clara New Users to Excel 2 March 22nd 07 04:45 PM
How to locate the Row and Column of an Active Cell Fred Excel Discussion (Misc queries) 1 December 7th 05 05:55 PM
Locate a cell, based on a criteria, then use the 'Cell' command... cdavidson Excel Discussion (Misc queries) 1 November 17th 05 06:30 PM
Locate max value of one column based on criteria in another colum JDay01 Excel Worksheet Functions 2 September 1st 05 06:47 PM


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

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

About Us

"It's about Microsoft Excel"