Excel VBA) 엑셀 데이터 범위 찾아내기
마지막 행과 마지막 열 찾아내기
Sub test()
MsgBox LastRow
MsgBox ActiveSheet.UsedRange.Columns.Count
End Sub
Function LastRow() As Long
s = StrReverse(ActiveSheet.UsedRange.Address)
n = InStr(s, "$") - 1
s = Left(s, n)
s = StrReverse(s)
LastRow = Val(s)
End Function
[출처] 마지막에 위치한 행 과 열 의 번호 구하기|작성자 낭만고양이
Sub getUsedRange()
MsgBox ActiveSheet.UsedRange.Address() & _
Chr(13) & Chr(13) & _
ActiveSheet.UsedRange.Address(ReferenceStyle:=xlR1C1)
End Sub
Sub getUsedRange()
MsgBox ActiveSheet.UsedRange.Address() & Chr(13) & Chr(13) &
MsgBox ActiveSheet.UsedRange.Address(ReferenceStyle:=xlR1C1)
End Sub