View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
p45cal[_70_] p45cal[_70_] is offline
external usenet poster
 
Posts: 1
Default For Each Row in Named Range


wpiet;459612 Wrote:
What is the simplest syntax to use to accomplish the following?:

For Each Row in [NamedRange]
If the value in column B = 1 and the value in column D <= [SomeValue]
Then
..
..
..
End If
Next Row

Thanks,
--
Will


Assuming th active sheet is the one in question,
either:
For Each cll In Intersect(Range("NamedRange"), Columns("B"))
If cll.Value = 1 And cll.Offset(, 2) <= Somevalue Then
'..
'..
End If
Next cll
orFor Each rw In Range("NamedRange").Rows
If Cells(rw.Row, 2) = 1 And Cells(rw.Row, 4) <= Somevalue Then
'..
'..
End If
Next rw
and lots more..


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=127188