skipjack02
skipjack02

Reputation: 3

Remove = from formula vba

My problem is that i have an excel file where sometimes a "=" is at the beginning of a cell making it a formula for excel. How can i search for those cells and remove the "="?

Thanks in advance!

Upvotes: 0

Views: 1699

Answers (2)

Maciej Los
Maciej Los

Reputation: 8591

You can try something like this:

For Each c in Sheet1.Range("A1:C5").Cells
    If Left(c.Formula,1) = "=" Then c.Formula = "'" & c.Formula
Next

Note: above code changes formula to text ;)

A1 => '=Bla bla bla

Upvotes: 1

R3uK
R3uK

Reputation: 14537

This should work smoothly and delete all of your "=" in sheet and keep formula visible :

For Each cell In ActiveSheet.UsedRange
    If Left(cell.Formula, 1) <> "=" Then

    Else
        cell.Formula = "'" & Right(cell.Formula, Len(cell.Formula) - 1)
    End If
Next cell

Upvotes: 0

Related Questions