獲取最后一非空單元格的行序或列序除了可以直接引用外還可以自定義函數來實現:
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-
|