M
Max
Hi guys,
I'm trying to use the Sub KillAllFormulas() to work on all the visible
sheets in the book, but the loop doesn't work (seems to stop on the active
sheet).
What I'm after is a sub which will simply kill all the formulas on all
visible sheets and retain all sheet formatting as-is (including merged
cells, if any). The latter Sub UnmergeSheet() below was recorded/used as
presence of merged cells seems to halt the "paste special as values"
process.
Any insights appreciated. Thanks.
-----
Sub KillAllFormulas()
Dim s As Worksheet
Application.DisplayAlerts = False
For Each s In ActiveWorkbook.Worksheets
UnmergeSheet
Cells.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Next
Application.DisplayAlerts = True
End Sub
Sub UnmergeSheet()
Cells.Select
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
End Sub
I'm trying to use the Sub KillAllFormulas() to work on all the visible
sheets in the book, but the loop doesn't work (seems to stop on the active
sheet).
What I'm after is a sub which will simply kill all the formulas on all
visible sheets and retain all sheet formatting as-is (including merged
cells, if any). The latter Sub UnmergeSheet() below was recorded/used as
presence of merged cells seems to halt the "paste special as values"
process.
Any insights appreciated. Thanks.
-----
Sub KillAllFormulas()
Dim s As Worksheet
Application.DisplayAlerts = False
For Each s In ActiveWorkbook.Worksheets
UnmergeSheet
Cells.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Next
Application.DisplayAlerts = True
End Sub
Sub UnmergeSheet()
Cells.Select
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
End Sub