XLA Routines: EE_ReverseSignInRange

Nick's picture
Sub EE_ReverseSignInRange(rng As Range)
'http://excelexperts.com/xla-routines-eeReverseSignInRange    for updates on this sub routine
' takes a range as input and reverses the sign of numbers in the range
' turns positive numbers negative and negative numbers positive
Dim theCell
 
    Set rng = Intersect(rng.Parent.UsedRange, rng)
    ' rng.select
    For Each theCell In rng
        If Application.IsNumber(theCell.value) Then
            theCell.value = theCell.value * -1
        End If
    Next
 
End Sub