Automatically inserting leading equal signs

Viewed 14

I've got several dozens of cells including text strings with ready formulas (sumif), without equal sign at the beginning. Instead of inserting the leading "=" signs manually, cell by cell, I would like to do this automatically for every selected cell.

After looping through simillar threads, I used this code:

Dim cel As Range

For Each cel In Application.Selection
cel.Formula = "=" & cel.Value
Next

However it works only with cells containing mathematical operation like "2+2". In case it contains deactivated formula, it not only does not become active but I am getting the follorwing error too:

Run-time error '1004': Application-defined or object-defined error

Any ideas what's wrong here?

0 Answers
Related