View Single Post
 
Old 05-26-2015, 10:49 AM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

Not tested but give this a try. It should loop through the cells from row 1 to row 50.

Code:
Private Sub Worksheet_Change() '(ByVal Target As Range)
Dim cel As Range
If Not Intersect(Range("A1:B1"), Target) Is Nothing Then
    If IsNumeric(Range("B1").Value) Then
        For Each cel In Range("A1:A50")
            Application.EnableEvents = False
            If Range("A" & cel.Row) = "" Then
                Range("B" & cel.Row) = Abs(Range("B" & cel.Row).Value)
            Else
                Range("B" & cel.Row) = -Abs(Range("B" & cel.Row).Value)
            End If
        Next cel
            Application.EnableEvents = True
    End If
End If
End Sub
Reply With Quote