How to Delete a Column Programmatically?

后端 未结 3 1603
不思量自难忘°
不思量自难忘° 2021-01-04 20:27

How does one delete a column (or multiple columns) in Excel?

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

3条回答
  •  抹茶落季
    2021-01-04 21:18

    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);
    

提交回复
热议问题