Sub thu() k = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1 MsgBox k End Sub
Sub thu() k = Selection.SpecialCells(11).Row MsgBox k End Sub
Public Function EndRowUsed() as Long
Dim sh As Worksheet
Dim ra As Range
Set sh = ActiveSheet
Set ra = sh.UsedRange
Application.Volatile
EndRowUsed = ra.Rows.Count + ra.Row - 1
End Function