I want to get the cell address of the last non empty cell within an excel sheet. Basically I want the row and column number/name of the last non empty cell. I have found few ansers to find out the value in the last non empty cell but I need cell adress not contents.
1 Answers
3
votes
For data like:
Most people would like to find the Blue cell:
Sub FindBlue()
Dim rng As Range
Set rng = Cells.Find(What:="*", After:=Cells(1), SearchDirection:=xlPrevious, searchorder:=xlByRows)
MsgBox rng.Address(0, 0)
End Sub
If you want the Yellow cell then:
Sub FindYellow()
Dim rng As Range
Set rng = Cells.Find(What:="*", After:=Cells(1), SearchDirection:=xlPrevious, searchorder:=xlByColumns)
MsgBox rng.Address(0, 0)
End Sub
range().value
, userange().address
. and next time show the code you already have – Patrick Lepelletier