Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
when looking at a range can certain rows be missed out
Below is my code for changing a value in a cell depending on what values are
in a range of rows. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo ErrHandler Application.EnableEvents = False If Not Intersect(Target, Me.Range("C2:C20")) Is Nothing Then Range("E63") = (Range("C63") - Target.Value) End If ErrHandler: Application.EnableEvents = True End Sub But is it possible to miss out certain rows of the range for example my range is A1:A100 but i dont want to include A23 and A25 is this possible |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
when looking at a range can certain rows be missed out
My preference for doing something like this would be to use a named range.
Create the range excluding the two cells. Part of the reason I like this method is that if down the road the range changes then you do not need to modify any code. You can do it directly in the code but it is more cumbersome and if anything changes then you will need to change the code. -- HTH... Jim Thomlinson "RobG2007" wrote: Below is my code for changing a value in a cell depending on what values are in a range of rows. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo ErrHandler Application.EnableEvents = False If Not Intersect(Target, Me.Range("C2:C20")) Is Nothing Then Range("E63") = (Range("C63") - Target.Value) End If ErrHandler: Application.EnableEvents = True End Sub But is it possible to miss out certain rows of the range for example my range is A1:A100 but i dont want to include A23 and A25 is this possible |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
when looking at a range can certain rows be missed out
Your posted code refers to cells in Columns C and Columns E. How do cells from Column A become involved? -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "RobG2007" wrote in message Below is my code for changing a value in a cell depending on what values are in a range of rows. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo ErrHandler Application.EnableEvents = False If Not Intersect(Target, Me.Range("C2:C20")) Is Nothing Then Range("E63") = (Range("C63") - Target.Value) End If ErrHandler: Application.EnableEvents = True End Sub But is it possible to miss out certain rows of the range for example my range is A1:A100 but i dont want to include A23 and A25 is this possible |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
when looking at a range can certain rows be missed out
it was an example to make life easyer
"Jim Cone" wrote: Your posted code refers to cells in Columns C and Columns E. How do cells from Column A become involved? -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "RobG2007" wrote in message Below is my code for changing a value in a cell depending on what values are in a range of rows. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo ErrHandler Application.EnableEvents = False If Not Intersect(Target, Me.Range("C2:C20")) Is Nothing Then Range("E63") = (Range("C63") - Target.Value) End If ErrHandler: Application.EnableEvents = True End Sub But is it possible to miss out certain rows of the range for example my range is A1:A100 but i dont want to include A23 and A25 is this possible |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can we find out any missed number in a series? | Excel Discussion (Misc queries) | |||
how we can find out any missed number in a series? | Excel Discussion (Misc queries) | |||
redistribution of missed targets | Excel Discussion (Misc queries) | |||
missed data | Excel Discussion (Misc queries) | |||
COUNTIF temporarily missed some cells | Excel Worksheet Functions |