|
【タイトル】 |
最後の行に移動する |
|
Sub Goto_LastRow()
'最後の行の「A列」に移動する
Dim LastRow As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A" & LastRow).Select
End Sub
|
|
|
【説明】 |
1行目:最後の行番号を取得する変数を定義 |
2行目:最後の行番号を取得 |
3行目:最後の行の「A列」に移動。 |
|
【別の方法1】 |
Range("A" & Cells(Rows.Count, 1).End(xlUp).Row).Select
|
【説明】 |
Rows.Count:データがある最後の行までの総数 |
Cells(Rows.Count, 1): |
Range("A" & Cells(Rows.Count, 1):最後の行の「A列」 |
|
【別の方法2】 |
Range("A1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
|
【説明】 |
|
|
|