VSTO(Excel)でアクティブなセルが含まれている範囲を選択する
リボンに追加したボタンを押した際、アクティブセルの含まれる範囲を選択状態にする。
using Excel = Microsoft.Office.Interop.Excel; // 中略 private void button_Click(object sender, RibbonControlEventArgs e) { Excel.Window window = e.Control.Context; Excel.Range activeCell = window.Application.ActiveCell; Excel.Range currentRegion = activeCell.CurrentRegion; currentRegion.Select(); }