.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to Format A Excle Column.

Posted By:Sajid P K       Posted Date: October 13, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

This Code Code Snippets Guide you to format EXCEL Column progrmaticaly. Here i am doing number formating

Follwing is the COde for formating the first Column of EXcel sheet. You Have to change the Column index of cell to format the required column 


 Dim Wb As Excel.Workbook =     
 Dim xWS As Excel.Worksheet
 xWS = Wb.ActiveSheet
 CType(xWS.Cells(1, 1),   Excel.Range).EntireColumn.NumberFormat = "#,##0.00"


          Excel.Workbook wb =    ;
          Excel.Worksheet xWS;
          xWS = wb.ActiveSheet;
          Excel.Range rng =     xWS.Cells[1,1] as  Excel.Range;
          rng.EntireColumn.NumberFormat = "#,##0.00";

Eg: For Seond Column Formating

 CType(xWS.Cells(1, 2),   Excel.Range).EntireColumn.NumberFormat = "#,##0.00"


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend