E
E
egor_spk2015-08-21 13:12:58
.NET
egor_spk, 2015-08-21 13:12:58

How to clear Excel cell contents but keep formulas in C#?

I am making a converter and I need to fill in a large table with a bunch of formulas.
Accordingly, headings and formulas should be left, and the rest of the content should be deleted.
Tried this method:

this._sheetDestination.Range["A4", "A" + firstCellDestination.Row].EntireRow.Delete(XlDirection.xlUp);

and
this._sheetDestination.Range["A4", "A" + firstCellDestination.Row].EntireRow.Clear();

But in both cases the formulas disappear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2015-08-21
@egor_spk

And if you loop through each cell from Range["A4", "A" + firstCellDestination.Row] and do not delete those that start with the "=" sign.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question