Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub GetRealLastCell()
Dim RealLastRow As Long Dim RealLastColumn As Long Range("A1").Select On Error Resume Next RealLastRow = _ Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row RealLastColumn = _ Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column Cells(RealLastRow, RealLastColumn).Select End Sub so you can use just this line: RealLastRow = _ Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row -- Regards, Tom Ogilvy "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim LastRow as Long
LastRow = Cells.SpecialCells(xlLastCell).Row -- steveB Remove "AYN" from email to respond "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many times gives inaccurate results for me.
-- Regards, Tom Ogilvy "STEVE BELL" wrote in message news:Ckipe.12887$yS2.5191@trnddc07... Dim LastRow as Long LastRow = Cells.SpecialCells(xlLastCell).Row -- steveB Remove "AYN" from email to respond "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Thanks! Forgot that Excel remembers the last cell even if all entries have been cleared. -- steveB Remove "AYN" from email to respond "Tom Ogilvy" wrote in message ... Many times gives inaccurate results for me. -- Regards, Tom Ogilvy "STEVE BELL" wrote in message news:Ckipe.12887$yS2.5191@trnddc07... Dim LastRow as Long LastRow = Cells.SpecialCells(xlLastCell).Row -- steveB Remove "AYN" from email to respond "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks to both of you!
Is it true that if it's certain that no cells were cleared after the last one, then Steve's simpler solution gives an accurate result? Stefi €žSTEVE BELL€ť ezt Ă*rta: Tom, Thanks! Forgot that Excel remembers the last cell even if all entries have been cleared. -- steveB Remove "AYN" from email to respond "Tom Ogilvy" wrote in message ... Many times gives inaccurate results for me. -- Regards, Tom Ogilvy "STEVE BELL" wrote in message news:Ckipe.12887$yS2.5191@trnddc07... Dim LastRow as Long LastRow = Cells.SpecialCells(xlLastCell).Row -- steveB Remove "AYN" from email to respond "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Steffi,
Is it true that if it's certain that no cells were cleared after the last one, then Steve's simpler solution gives an accurate result? Note Tom Ogilvy's comment: so you can use just this line: RealLastRow = _ Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row The macro provided by Tom: Returns the last populated row Returns the last populated column Selects the last populated cell. Tom's oneliner would seem to provide a solution to your explicit request which is both simple (short) and consistently accurate. --- Regards, Norman "Stefi" wrote in message ... Thanks to both of you! Is it true that if it's certain that no cells were cleared after the last one, then Steve's simpler solution gives an accurate result? Stefi "STEVE BELL" ezt írta: Tom, Thanks! Forgot that Excel remembers the last cell even if all entries have been cleared. -- steveB Remove "AYN" from email to respond "Tom Ogilvy" wrote in message ... Many times gives inaccurate results for me. -- Regards, Tom Ogilvy "STEVE BELL" wrote in message news:Ckipe.12887$yS2.5191@trnddc07... Dim LastRow as Long LastRow = Cells.SpecialCells(xlLastCell).Row -- steveB Remove "AYN" from email to respond "Stefi" wrote in message ... Hi all, I found several tips for finding the last row containing data in a specific column. But what can I do for finding the last row containing not empty cells in any of the columns? Stefi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide column(x) by column(y) to give column(x/y) in excel? | New Users to Excel | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
Return text in Column A if Column B and Column K match | Excel Worksheet Functions | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Divide Column A by Column B multiply Column C | Excel Worksheet Functions |