How to get the address of the last not empty cell in excel using MACROS (VBA)
1 answer
For data of type:
Most people would like to find 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 a 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
+3
source to share