Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can we find out any missed number in a series? Excel Excel Discussion (Misc queries) 4 May 17th 06 04:57 PM
how we can find out any missed number in a series? Excel Excel Discussion (Misc queries) 1 May 17th 06 04:26 PM
redistribution of missed targets Huber57 Excel Discussion (Misc queries) 0 March 16th 06 02:09 AM
missed data rjl Excel Discussion (Misc queries) 2 January 10th 06 01:37 PM
COUNTIF temporarily missed some cells dstx Excel Worksheet Functions 0 July 18th 05 08:42 PM


All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"