View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Huang [MSFT] Peter Huang [MSFT] is offline
external usenet poster
 
Posts: 225
Default Progamatically Formating Cells within VSTO for Excel Application Development using C#

Hi

You may try the code below which works on my side.
private void button1_Click(object sender, EventArgs e)
{
for (int k = 1; k <= Globals.Sheet1.Rows.Count; k++)
{
Excel.Range cell = ((Excel.Range)Globals.Sheet1.Cells[k,
2]);
cell.NumberFormat = "h:mm:ss";
}
}

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.