Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created August 29, 2016 06:34
Show Gist options
  • Save cocodrips/729855438297ae6ba88c4a6f66790633 to your computer and use it in GitHub Desktop.
Save cocodrips/729855438297ae6ba88c4a6f66790633 to your computer and use it in GitHub Desktop.
Excelの選択してるCellとる
using Excel = Microsoft.Office.Interop.Excel;
# ...
public List<string> GetSelectedItems() {
Excel.Range range = Globals.ThisAddIn.Application.Selection as Excel.Range;
List<string> cells = new List<string>();
foreach (string cell in range.Value)
{
cells.Add(cell);
}
return cells;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment