View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
anilsolipuram[_112_] anilsolipuram[_112_] is offline
external usenet poster
 
Posts: 1
Default Create scenarios using macro and data in cells


I am not sure if this is what you are looking for.

right click sheet tab-view code, and paste this code


whenever you change any value at a2:a7 or b2:b7 , c2:c7 will
automatically sum a and b cells

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t As Range
Set t = Application.Intersect(Range("$A$1:$B$7"), Target)
If t Is Nothing Then
Else
For Each C In Range("A2:A7")
TEMP = C.Offset(0, 1).Value + C.Value
If TEMP < 0 Then
C.Offset(0, 2).Value = TEMP
End If
Next
End If
End Sub


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=382252