View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Changing cells temp.

Here is code that works with your sample sheet:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo Errhandler
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("B7:C7")) Is Nothing Then
If Len(Trim(Target.Value)) = 0 Then Exit Sub
Application.EnableEvents = False
If Target.Address = "$B$7" Then
If IsNumeric(Target.Offset(-1, 0)) And _
Not IsEmpty(Target.Offset(-1, 0)) Then
If Target.Offset(-1, 0).Value < 0 Then
Target.Offset(0, 1).Value = _
Target / Target.Offset(-1, 0)
End If
End If
Else
If IsNumeric(Target) Then
Target.Offset(0, -1) = Target.Offset(-1, -1) * _
Target
End If
End If
End If
If Not Intersect(Target, Range("E7,G7,I7,K7,M7,O7")) Is Nothing Then
If Len(Trim(Target.Value)) = 0 Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Range("E7,I7,M7")) Is Nothing Then
If IsNumeric(Target.Offset(-1, 0)) And _
Not IsEmpty(Target.Offset(-1, 0)) Then
If Target.Offset(-1, 0).Value < 0 Then
Target.Offset(0, 2).Value = _
Target / Target.Offset(-1, 0)
End If
End If
Else
If IsNumeric(Target) Then
Target.Offset(0, -2) = Target.Offset(-1, -2) * _
Target
End If
End If
End If
Errhandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"fwday" wrote in message
...
Tom, I am sorry to keep bugging you. For some reson it is just not
working for me. I take the codes you send me and past them into the VB
on sheet 1 and the only thing I get is the first set of numbers to
work. This time I am adding in a copy of the actual form I am working
on so you can see my problem. I have been working with the example
that I origanaly sent you. If you have an e-mail address you want me
to send it to I can do that also.

File Attached: http://www.excelforum.com/attachment.php?postid=335476 (p &

l panner renton oct. 2003.xls)

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/