vba 行列 取得 | 備忘録 (。・_・。)ノ
Sub test()

    '使用範囲セレクト
    Worksheets("Sheet1").Range("A1").CurrentRegion.Select
    '使用範囲セレクト
    ActiveSheet.UsedRange.Select
    '使用したセル範囲だけを再計算する
    Selection.Calculate

    '選択範囲 1行目
    MsgBox Selection(1).Row
    '選択範囲 8行目
    MsgBox Selection(Selection.Count).Row
    '選択範囲 1列目
    MsgBox Selection(1).Column
    '選択範囲 7列目
    MsgBox Selection(Selection.Count).Column

    '選択範囲 $A$1:$G$8
    MsgBox Selection.Address
    MsgBox ActiveSheet.UsedRange.Address
    
    '入力最終行 8行
    MsgBox Cells(Rows.Count, 1).End(xlUp).Row
    '入力最終列 7列
    MsgBox Cells(1, Columns.Count).End(xlToLeft).Column

    '入力最終行 8行
    MsgBox Range("A1").End(xlDown).Row
    '入力最終列 7列
    MsgBox Range("A1").End(xlToRight).Column
    
    With Range("A1").SpecialCells(xlLastCell)
        '入力最終行 8行
        MsgBox .Row
        '入力最終列 7列
        MsgBox .Column
    End With
    
    With ActiveSheet.UsedRange
        '入力最終行 8行
        MsgBox .Rows.Count
        '入力最終列 7列
        MsgBox .Columns.Count
    End With
    
    '最大行 1,048,576行
    MsgBox Rows.Count
    '最大列 16,384列
    MsgBox Columns.Count
    '最大行 1,048,576行
    MsgBox Cells(Rows.Count, 1).End(xlDown).Row
    '最大列 16,384列
    MsgBox Cells(1, Columns.Count).End(xlToRight).Column

        
End Sub