View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
jlig via OfficeKB.com jlig via OfficeKB.com is offline
external usenet poster
 
Posts: 2
Default AfterUpdate Code to Subtract Column (L) from (G)

Almost, After I added in the Dim for TargetRow, it all works great!
Thanks so much..

Final code:
-----------------
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Variant
Dim TargetRow As Variant
Set isect = Intersect(Target, Range("L2:L100"))
If Not isect Is Nothing Then
TargetRow = Target.Row
Range("G" & TargetRow) = Range("G" & TargetRow) - Range("L" & TargetRow)
End If
End Sub
---------------------







Per Jessen wrote:
As the result in isect can be either a range or 'Nothing', you have to use

Dim isect as Variant

Regards,
Per

Thanks for the reply..
I tried the code..get Compile Error: Variable not defined?

[quoted text clipped - 36 lines]
Thanks,
jlig


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200906/1