I've have the following code which when run allows me to 'comment out' and 'uncomment' a range of formula on a worksheet which works really well, however I've now had to change one of the formula to an array formula using CTRL, SHIFT, ENTER. Is there any way to adapt the code so that when uncommented it forces the array formula to remain as array formula? At the moment when uncommenting the array formula no longer remain as array formula?
This is my array formula
{=SUM('C:\Folder1\Folder2\Folder3\Folder4\[FileName]Sheet1'!$A:$A)}
and this is the code
Sub CommentOut()
Dim c As Range
On Error Resume Next
For Each c In Selection.SpecialCells(xlCellTypeFormulas)
c.Formula = "'" & c.Formula
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Next c
If Err = 0 Then MsgBox "Formulas Commented Out", vbInformation
On Error GoTo 0
End Sub
Sub Uncomment()
Dim c As Range
On Error Resume Next
For Each c In Selection.SpecialCells(xlCellTypeConstants)
c.Formula = Replace(c.Formula, "'=", "=")
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Next c
If Err = 0 Then MsgBox "Formulas Restored", vbInformation
On Error GoTo 0
End Sub
Many thanks
Bookmarks