Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Ha, I will! You know how these guys operate, don't you? They ask for one
thing, when they get it, they remember: "Oh, yeah, I need this other thing too!". Ah, well, that's the way things are some times! Thanks, again for ALL the HELP! "Bernie Deitrick" wrote: Jay, Tell your managers to mind their own business ;-) Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("AI3:AI6000")) Is Nothing Then Application.EnableEvents = False For Each myCell In Intersect(Target, Range("AI3:AI6000")) Range("X" & myCell.Row).Value = _ Range("X" & myCell.Row).Value + 1 Range("AA" & myCell.Row).Value = _ Range("AA" & myCell.Row).Value + myCell.Value Next myCell Application.EnableEvents = True End If If Not Intersect(Target, Range("AH3:AH6000")) Is Nothing Then Application.EnableEvents = False For Each myCell In Intersect(Target, Range("AH3:AH6000")) Range("W" & myCell.Row).Value = _ Range("W" & myCell.Row).Value + 1 Range("Z" & myCell.Row).Value = _ Range("Z" & myCell.Row).Value + myCell.Value Next myCell Application.EnableEvents = True End If End Sub HTH, Bernie MS Excel MVP "Jay" wrote in message ... Hi Bernie: Now I need to add these refferences also, as requested by the managers: Private Sub Worksheet_Change(ByVal Target As Range1) If Intersect(Target, Range1("AI3:AI6000")) Is Nothing Then Exit Sub Application.EnableEvents = False For Each myCell In Intersect(Target, Range("AI3:AI6000")) Range1("X" & myCell.Row).Value = Range1("X" & myCell.Row).Value + 1 Range1("AA" & myCell.Row).Value = Range1("AA" & myCell.Row).Value + myCell.Value Next myCell Application.EnableEvents = True End Sub These guys above are additional columns! "Bernie Deitrick" wrote: Actually, if you want to handle multiple cells at the same time, you would need to step through each cell in the changed range: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("AH3:AH600")) Is Nothing Then Exit Sub Application.EnableEvents = False For Each myCell In Intersect(Target, Range("AH3:AH600")) Range("W" & myCell .Row).Value = Range("W" & myCell .Row).Value + 1 Range("Z" & myCell .Row).Value = Range("Z" & myCell .Row).Value + myCell ..Value next myCell Application.EnableEvents = True End Sub HTH, Bernie MS Excel MVP "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Jay, You may want to modify the second If (remove it) if you want to be able to change multiple cells in AH3:AH6000 at the same time. Also, this version doesn't account for deletion (clearing the cell). Didn't know what you wanted to do, so clearing the cell will still increment column W's count. Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("AH3:AH600")) Is Nothing Then Exit Sub If Target.Cells.Count 1 Then Exit Sub Application.EnableEvents = False Range("W" & Target.Row).Value = Range("W" & Target.Row).Value + 1 Range("Z" & Target.Row).Value = Range("Z" & Target.Row).Value + Target.Value Application.EnableEvents = True End Sub HTH, Bernie MS Excel MVP "Jay" wrote in message ... Bernie: I need to have this function cover the range of W3:W6000, Z3:Z6000, AH3:AH6000. I attempted to modify this with no success. Can you assist here too: Private Sub Worksheet_Change(ByVal Target As Range) 'Plugging the starting value in column Z and increasing it incrementally If Target.Address < "$AH$3" Then Exit Sub Application.EnableEvents = False Range("W3").Value = Range("W3").Value + 1 Range("Z3").Value = Range("Z3").Value + Target.Value Application.EnableEvents = True End Sub THanks, "Bernie Deitrick" wrote: Jay, You could use the worksheet change event. Copy the code below, right click on the sheet tab, select "View Code" and paste the code in the window that appears. HTH, Bernie MS Excel MVP Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address < "$AH$3" Then Exit Sub Application.EnableEvents = False Range("W3").Value = Range("W3").Value + 1 Range("Z3").Value = Range("Z3").Value + Target.Value Application.EnableEvents = True End Sub "Jay" wrote in message ... What I'd like to do is this. I have two (maybe 4 columns needed) columns, W3 = (4) and Z3 = (521). What I need to do is add a value to cell AH3 = (71) and have cell Z3 increase by that number =(592) and have W3 increase by adding 1 to the value =(5) already in there. However, both the vlues in W3 and Z3 will be retained until another value is added in column AH3, then, increase cell Z3 by that value and cell W3 increase by 1 only each time Z3 increases. Is this possible? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|