View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
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