Just seemed that was a lot of bother just to change the sign
of the cells in a range, so wrote a macro. It does not fully check
that parens are matched and in correct order though, so stripping
parens could result in a an error in the formula. Perhaps something
could be done better with Regular Expressions.\
Sub ChangePlusMinus()
'D.McRitchie, 2004-08-11 excel.misc
'--
www.mvps.org/dmcritchie/excel/numconv.htm
'-- Additional code added to check parens to not misprocess
'-- =(A1+1)*(B1+1) * -1 --- but is not foolproof i.e. =((a1+1))*...
'-- Will not treat ="1"&"2" as a number
'-- Best for Constants and avoiding Empty cells
Dim cell As Range, txt As String
On Error Resume Next
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlCellTypeConstants, 1))
cell.Value = cell.Value * -1
Next cell
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlCellTypeFormulas, 1))
If Right(cell.Formula, 6) = ") * -1" And _
InStr(3, cell.Formula, "(") <= InStr(3, cell.Formula, ")") And _
Left(cell.Formula, 2) = "=(" Then
cell.Formula = "=" & Mid(cell.Formula, 3, Len(cell.Formula) - 8)
Else
cell.Formula = "=(" & Mid(cell.Formula, 2) & ") * -1"
End If
Next cell
End Sub