private void 網掛け25_Click(object sender, RibbonControlEventArgs e) { //選択範囲の取得 Range selection = (Range)Globals.ThisAddIn.Application.Selection; //選択範囲の数 int count = selection.Areas.Count; //複数選択範囲を配列に入れる Range[] allRange = new Range[count]; //それぞれの選択範囲について繰り返す foreach (Range r in selection.Areas) { //パターンを網掛け25%に r.Interior.Pattern = XlPattern.xlPatternGray25; } }