LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default for and if statement within another for/if statement

hey guys, is there a better way to do something like this? i have a for
statement checking an entire column for a value of zero, and if it
finds that value, i want it to check a different column for a value of
<= 1, and if it finds that, cut the row out and paste it somewhere
else. heres my (horrible) code:


Sheets("ReArranged - No Formulas").Select
For Each rng In Range("N:N")
If rng.Value = 0 Then

For Each rng2 In Range("Y:Y")
If rng2.Value <= 1 Then
rng2.EntireRow.Cut Destination:=Sheets("DO NOT USE").Range("A" &
Sheets("DO NOT USE").Rows.Count).End(xlUp).Offset(1, 0)
End If
Next rng2

End If
Next rng

 
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



All times are GMT +1. The time now is 01:19 AM.

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

About Us

"It's about Microsoft Excel"