How to focus or select a cell in Excel

venkat picture venkat · Mar 25, 2010 · Viewed 23.5k times · Source

How to focus a cell in Excel VSTO using C# or to select first cell using C# in VSTO?

Answer

Mikael Svenson picture Mikael Svenson · Mar 25, 2010

Here is one way:

Excel.Worksheet activeSheet = ThisAddIn.ExcelApplication.ActiveSheet;
var range = activeSheet.get_Range("A1", "A1");
range.Select();

ThisAddIn is the name of my test project.