获取最后一非空单元格的行序或列序除了可以直接引用外还可以自定义函数来实现:
Public Function End_Col(rag As Range) As Integer'自定义函数获取最后非空单元格的行序-
'ActiveCell.Row-
Dim aa As Integer-
-
For Each temp In rag-
If temp.Value <> "" Then-
aa = temp.Row'获取行序-
'aa=temp.column'获取列序-
End If-
Next temp-
End_Col = aa-
End Function-
-
示例:-
只有B23非空,则End_Col(A2:B100)=23-
|