Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
AfterUpdate Code to Subtract Column (L) from (G)
Hi
It should work if your code is placed in the code sheet for ThisWorkbook. But only for changes in L2. As I suppose you only want this function on one sheet, I suggest you use a Worksheet_Change event, which is to be placed in the code sheet for the desired worksheet. The solution below work on changes in L2:L100: Private Sub Worksheet_Change(ByVal Target As Range) 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 Hopes this helps. --- Per "jlig" <u52556@uwe skrev i meddelelsen news:9786d51c99e8b@uwe... - Column L is the sold column. - Column G is the Remaining Qty in Stock. - When the value in L is typed in, I need the value in G (Qty in Stock) to lower by that L value I need this Code to run "after" the user types in the L value and hits "Enter" or "Arrow Down" I have tried this, but it does nothing at all? ----------------------------------------------------------- Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$L$2" Then Range("G2") = Range("G2") - Range("L2") End If End Sub ---------------------------------------------------------- Thanks, jlig |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
add or subtract every 5th column | Excel Discussion (Misc queries) | |||
subtract column right from column left in excel? | New Users to Excel | |||
Subtract and multiply as a code ???????? | Excel Discussion (Misc queries) | |||
How do I subtract one column from another? | New Users to Excel | |||
VBA CODE to Subtract two cells | Excel Programming |