Formatting a Range of Cells

Setting Font & Style of a Range of Cells

Before we talk about formatting settings (that we have already talked a lot in our previous topics), we should know about how to create a range of cells. Well, we can create a range of cells using CellRange class whose constructor takes some parameters to specify the range of cells. We can specify the cells range using the Names or Row & Column Indices of start and end cells.

Once we have created a CellRange object then we can use the overloaded versions of SetStyle, SetFont & SetFontColor methods of Worksheet that can take a CellRange object to apply formatting settings on the specified range of cells.

Let’s check out an example to understand this basic concept.