Udostępnij za pośrednictwem


Work with ranges

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The NamedRange and Range classes contain the methods and properties you use to perform tasks with ranges.

Task Procedure
Access a range and set the value. How to: Programmatically refer to worksheet ranges in code
Fill a range based on an initial value. How to: Programmatically automatically fill ranges with incrementally changing data
Get and set date values in cells. How to: Programmatically store and retrieve date values in Excel ranges
Apply styles to cells in a region. How to: Programmatically apply styles to ranges in workbooks
Search for text in worksheet ranges. How to: Programmatically search for text in worksheet ranges
Apply color to text in a range of cells. How to: Programmatically apply color to Excel ranges
Run Excel calculations programmatically. How to: Programmatically run Excel calculations
Display a string in a cell. How to: Programmatically display a string in a worksheet cell

For more information about Excel tasks and the Excel object model, see Excel object model overview.

In some cases, the ways that you perform these tasks in VSTO Add-ins is different from the ways that you perform them in document-level customizations.

See also