Thread: Error in Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Error in Code

Jim,

This works fine for me

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("F5:F2005")) Is Nothing Then
If Target.Offset(0, -3).Value = "Sale of Item" Or _
Target.Offset(0, -3).Value = "Shrinkage" Then
Target.Value = Target.Value * -1
End If
End If
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

"Jim May" wrote in message
news:5UHfe.2801$It1.87@lakeread02...
With:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("F5:F2005")) Is Nothing _
And Target.Offset(0, -3).Value = "Sale of Item" Or
Target.Offset(0, -3).Value = "Shrinkage" Then
Target.Value = Target.Value * -1
End If
Application.EnableEvents = True
End Sub

When I select from Col C either Sale of Item or Shrinkage and enter say 5

in
my Col F my intention (with the code above is to convert the 5 in Cell F12
(say) to -5.
But that is not happening.
Can someone assist me?
TIA,