RSS

How do I change the format of an entire column?

07 Mar

To change the format of an entire column, you need to use the EntireColumn property to get the range of cells and
change the NumberFormat property of that specific range.

//Change the format for the entire column accordingly.
Microsoft.Office.Interop.Excel.Range range = activeCell.EntireColumn;
if (isChangeToGeneralFormat)
range.NumberFormat = "General"; //format as General.
else
range.NumberFormat = "@"; //format as Text;

Advertisements
 
Leave a comment

Posted by on March 7, 2011 in Microsoft VSTO - Excel

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: