C# – How to Make an Excel worksheet scroll to a row programatically

cexcel-2010vsto

I have a VSTO add-in for Excel that populates a listobject in a worksheet with data, and I would like to the sheet to automatically scroll to show the bottom of the list (without forcing focus onto this sheet if the user is looking at another). Is there a way to do this programmatically?

Thanks <333

Best Answer

NOTE: This answer is taken from Ben Stabile's comment under the accepted answer; just in case other people are looking for a 'correct' answer but didn't happen to see the comment. I tried what Ben suggested and it achieves exactly what "Go To" in Excel does.

activeCell.Select() will simply select the cell even if it is not in view. The correct way to do this is to use something like: Application.ActiveWindow.ScrollRow = range.Rows.Count.

Related Topic