View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default If then else problem

I answered your OTHER version of this question. Just modify to put into a
loop

Right click sheet tabview codeinsert this.

Private Sub Worksheet_Change(ByVal Target As Range)
'On Error Resume Next
If Target.Address < Range("c3").Address Then Exit Sub
If Not IsNumeric(Target) Then
If IsNumeric(Target.Offset(1)) Then
Target.Offset(1) = -Abs(Target.Offset(1))
End If
End If
End Sub
=========
For your CURRENT question

Sub loopchgvaluetoneg()
For Each c In Range("c12:c15")
If Not IsNumeric(c) Then
If IsNumeric(c.Offset(, 1)) Then
c.Offset(, 1) = -Abs(c.Offset(, 1))
End If
End If
Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Legal Learning" wrote in message
...
I think I originally posted this in the wrong category and now realize this
has to be a vba macro situaion. AHHH! This means trouble for me. :)

Here is what I need:

If the any cell in column C has text, then the numeric values in column D
must be negatives. They are currently all postive numbers now. There are
many fields that do not have any text in column C and those numbers must
remain postivie numbers.

Any help is greatly, greatly appreciated.
--
CLG