View Single Post
  #3   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

<Smack forehead

Of course, my code as written changes negative values to positive, not
positive to negative.

Simply change

If myCell.Value < 0 Then myCell.Formula = _

to

If myCell.Value 0 Then myCell.Formula = _

Sorry about that,
Bernie
MS Excel MVP

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Lob,

You would need to use the worksheet's change event. For example, if you
enter a 1 into column Q, the code below will change all negatives to
positives in column V to Z. It also allows you to undo your changes by
changing the 1 back to 0.

Copy the code below, right click on the sheet tab, select "View Code" and
paste the code in the window that appears.

HTH,
Bernie
MS Excel MVP


Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range

If Target.Column < 17 Then Exit Sub
Application.EnableEvents = False
If Target.Value = 1 Then
For Each myCell In Range("V" & Target.Row).Resize(1, 5)
If myCell.Value < 0 Then myCell.Formula = _
"=-(" & myCell.Formula & ")"
Next myCell
End If
If Target.Value = 0 Then
For Each myCell In Range("V" & Target.Row).Resize(1, 5)
If Left(myCell.Formula, 3) = "=-(" Then myCell.Formula = _
Mid(myCell.Formula, 4, Len(myCell.Formula) - 4)
Next myCell
End If

Application.EnableEvents = True
End Sub



"lob" wrote in message
oups.com...
Is it possible to automatically switch positive values to negative
values to entries in columns v to ir just by entering a 1 in either
column q or r on that same row. Conditional formatting?
Thanks in advance, Lob