[英]How to get adress of last non empty cell in a excel using MACROS(VBA)
I want to get the cell address of the last non empty cell within an excel sheet. 我想获取Excel工作表中最后一个非空单元格的单元格地址。 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.
我找到了很少的激光器来找出最后一个非空单元格中的值,但我需要单元格地址而不是内容。
For data like: 对于以下数据:
Most people would like to find the Blue cell: 大多数人都想找到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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.