Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I exclude a cell from a range?

I want to exclude a cell from a range of data. That cell may or may not be at the extremities of the range.

Say I have the range for column A, A:A and I want to exclude every cell which satisfies a condition. And this is not for sum or average but what I'm trying to do is get a range without those cells so it can be used elsewhere.

Can anyone help me?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default How do I exclude a cell from a range?

Hi Vinay

Try

For each c in myRng


Hi
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default How do I exclude a cell from a range?

Take 2

Try
Dim myRng as Range, c as Range
Set myRng = Sheets("YourSheet").Range("A2:A1000")
For each c in myRng
if not c = (myCriteria) then
exit sub
with c
'Do Something
End With
Next c

HTH
Mick
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default How do I exclude a cell from a range?

Take 2

Try
Dim myRng as Range, c as Range
Set myRng = Sheets("YourSheet").Range("A2:A1000")
For each c in myRng
if not c = (myCriteria) then
exit sub
with c
'Do Something
End With
Next c

HTH
Mick


Well this clearly will exit on the 1st cell that doesn't fit myCriteria
and leave the remaining cells not processed! Better way...

If c = (myCriteria) Then
'//do something with c
End If

...so all cells in the range that fit myCriteria get processed!<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
Resize Table Range to exclude zero values and Input New Range into achart object jparnold Excel Programming 10 December 22nd 09 04:09 PM
How to exclude a cell(s) from a range w/o mult. ranges on any fcn civileng Excel Worksheet Functions 2 April 25th 07 07:32 PM
How to exclude certain cells from a range? Ed Excel Programming 5 January 11th 06 06:18 PM
Exclude Header from Range? nastech Excel Discussion (Misc queries) 4 December 30th 05 02:49 PM
Exclude one range from another Charl Excel Programming 3 September 11th 05 12:26 PM


All times are GMT +1. The time now is 11:50 PM.

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"