views:

37

answers:

2

I am reading this (Excel Tasks) to automate some Excel operations in VS2008 C#
http://msdn.microsoft.com/en-us/library/syyd7czh%28v=VS.80%29.aspx

But I couldn't find how to delete a column (or multiple columns).

eg. How to delete column C and shift the rest left?

Thanks in advance.

+1  A: 

Here is the solution to make it clearer (thanks to Leniel for the link)

  Excel.Range range = (Excel.Range)sheet.get_Range("C1", Missing.Value);
  range.EntireColumn.Delete(Missing.Value);
  System.Runtime.InteropServices.Marshal.ReleaseComObject(range);