Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Excel 2003
What approach in VBA to get the maximum number of rows of actual data in any one column. I do know how to get Rows & Columns in the Used Range - but I need cells with data not cells with formatting. My mind does not work well in the 3rd dimension - i.e. arrays. The consepts which come to mind are MAX() and Array() and .End() Can anyone help? Thanks! EagleOne |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here is sample code getting the last row with data two ways: once specifying
the column number, and once specifying the column letter. Sub AAAAA() Dim LastRow As Long 'With column as number. LastRow& = Cells(Rows.Count, 3).End(xlUp).Row MsgBox LastRow& 'With column as letter' LastRow& = Range("C" & Rows.Count).End(xlUp).Row MsgBox LastRow& End Sub Hope this helps, Hutch "donoteventry" <donoteventry, "removes"" wrote: Excel 2003 What approach in VBA to get the maximum number of rows of actual data in any one column. I do know how to get Rows & Columns in the Used Range - but I need cells with data not cells with formatting. My mind does not work well in the 3rd dimension - i.e. arrays. The consepts which come to mind are MAX() and Array() and .End() Can anyone help? Thanks! EagleOne |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Tom,
Thanks for the reply. Your approach manually does one column at a time. Is there not a way to obtain the Max Rows in any column? EagleOne Tom Hutchins wrote: Here is sample code getting the last row with data two ways: once specifying the column number, and once specifying the column letter. Sub AAAAA() Dim LastRow As Long 'With column as number. LastRow& = Cells(Rows.Count, 3).End(xlUp).Row MsgBox LastRow& 'With column as letter' LastRow& = Range("C" & Rows.Count).End(xlUp).Row MsgBox LastRow& End Sub Hope this helps, Hutch "donoteventry" <donoteventry, "removes"" wrote: Excel 2003 What approach in VBA to get the maximum number of rows of actual data in any one column. I do know how to get Rows & Columns in the Used Range - but I need cells with data not cells with formatting. My mind does not work well in the 3rd dimension - i.e. arrays. The consepts which come to mind are MAX() and Array() and .End() Can anyone help? Thanks! EagleOne |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is there not a way to obtain the Max Rows in any column?
One idea... Sub LastRow() Dim LastRow As Long LastRow = Cells.Find( _ What:="*", _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row End Sub -- HTH. :) Dana DeLouis Windows XP, Office 2003 <donoteventry; <removes; wrote in message ... Tom, Thanks for the reply. Your approach manually does one column at a time. Is there not a way to obtain the Max Rows in any column? EagleOne Tom Hutchins wrote: Here is sample code getting the last row with data two ways: once specifying the column number, and once specifying the column letter. Sub AAAAA() Dim LastRow As Long 'With column as number. LastRow& = Cells(Rows.Count, 3).End(xlUp).Row MsgBox LastRow& 'With column as letter' LastRow& = Range("C" & Rows.Count).End(xlUp).Row MsgBox LastRow& End Sub Hope this helps, Hutch "donoteventry" <donoteventry, "removes"" wrote: Excel 2003 What approach in VBA to get the maximum number of rows of actual data in any one column. I do know how to get Rows & Columns in the Used Range - but I need cells with data not cells with formatting. My mind does not work well in the 3rd dimension - i.e. arrays. The consepts which come to mind are MAX() and Array() and .End() Can anyone help? Thanks! EagleOne |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
By golly he hits a home run! Thanks!
"Dana DeLouis" wrote: Is there not a way to obtain the Max Rows in any column? One idea... Sub LastRow() Dim LastRow As Long LastRow = Cells.Find( _ What:="*", _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
repeat a formula same column same number of rows apart | Excel Discussion (Misc queries) | |||
Return SEARCHED Column Number of Numeric Label and Value | Excel Worksheet Functions | |||
Need rows in Column A removed if they fully or partially match with any Column B row | Excel Discussion (Misc queries) | |||
match and count words | Excel Worksheet Functions | |||
moving alternating rows to a column with the order staying the sam | Excel Discussion (Misc queries) |