Delete formula if....

  • Thread starter Thread starter LiAD
  • Start date Start date
L

LiAD

Hi,

In a workboook of 15 sheets I have a lot of cells with formulas that will
return either useful data (numerical values or text) or nothing ("").

What sub could I use to get excel to check all of the sheets and delete the
formulas from cells that =""? All other cells need left as they are.

Thankyou
LiAD
 
Sub test()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets

Dim r As Range
Set r = ws.Cells.SpecialCells(xlCellTypeLastCell)

Dim c As Range
For Each c In ws.Range("A1", r.Address)
If c.Value = "" Then c.Formula = ""
Next c

Next ws
End Sub
 
Great

Thanks

Sam Wilson said:
Sub test()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets

Dim r As Range
Set r = ws.Cells.SpecialCells(xlCellTypeLastCell)

Dim c As Range
For Each c In ws.Range("A1", r.Address)
If c.Value = "" Then c.Formula = ""
Next c

Next ws
End Sub
 
Back
Top