0

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?

braX
  • 11,506
  • 5
  • 20
  • 33
CodeFrage
  • 1
  • 1
  • Likely you want `.FormulaLocal` instead of `.Formula`. Or `.Formula2Local` if you have Excel 365. – BigBen Sep 07 '22 at 19:26

0 Answers0