Of course you\'re going to answer this question with the =\"\"
formula to be written in the aforementioned cell, but this is not my case.
Actually, I ha
This may not fix your problem as I don't have the QuantLibXL, but if you wanted to delete all the cells that evaluated to "" on a sheet, you could try:
sheet.UsedRange.SpecialCells(xlCellTypeFormulas, 2).Select
Selection.ClearContents
This will find all formulas that result in text and then delete them. Note: this could fail if there are none, and also may be too aggressive.
Another trick is to change your formula to something like:
=if([condition], NA(), [formula])
Now, instead of empty cells, the values will be an error (#N/A). Perhaps the library understands errors instead of values of 0 or "".
If you wanted to then delete all the errors from your sheet, you would modify the VBA code above to find all the formula's resulting in errors:
sheet.UsedRange.SpecialCells(xlCellTypeFormulas, 16).Select
Selection.ClearContents
Again, if there are none, this would error.
Not the best answer, but perhaps some food for thought.
Bad news: you can't. Once a cell contains a formula it is never in a truly blank state.
E.g. set a cell to =A1, and you see that a 0 will appear in that cell; even when A1 is itself blank.