hakeの日記

Windows環境でプログラミングの勉強をしています。

EXCEL VBAメモ - シート上の選択範囲の移動とサイズ変更

Range("A1:C3").Select
    
' 選択範囲を広さを保持したまま縦 + 1, 横 + 1へ移動
Selection.Offset(1, 1).Select
MsgBox Selection.Address        ' B2:D4
    
' 選択範囲の広さを縦 - 1, 横 - 1に変更
Selection.Resize(Selection.Rows.Count - 1, Selection.Columns.Count - 1).Select
MsgBox Selection.Address        ' B2:C3