Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop not working properly
I am trying to loop through a file and have each record searched for
information then moved to a new sheet based on the findings. The macro seems to be working for the first record on the file but it doesn't seem to be looping through for each record. I'm not sure where I went wrong in my macro. Sub life_file() Set rangetosearch = ActiveSheet.UsedRange Set cellelement = rangetosearch.Cells Count = 1 For Each cellelement In rangetosearch Range("x1") = rangetosearch If Range("x1").Value Or Range("ae1").Value Or Range("ah1").Value 0 Then ActiveCell.EntireRow.Copy Sheets("LIFE").Select ActiveSheet.Paste Sheets("EOI_TEST").Select ElseIf Range("aa1").Value Or Range("ac1").Value 0 Then ActiveCell.EntireRow.Copy Sheets("LTD_STD").Select ActiveSheet.Paste ElseIf Range("x1").Value And Range("ae1").Value And Range("ah1").Value And _ Range("aa1").Value And Range("ac1").Value 0 Then ActiveCell.EntireRow.Copy Sheets("LIFE").Select ActiveSheet.Paste Sheets("LTD_STD").Select ActiveSheet.Paste End If Count = Count + 1 Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Do Until Loop not functioning properly | Excel Programming | |||
Do Until Loop not functioning properly | Excel Programming | |||
But not working properly | Excel Discussion (Misc queries) | |||
how to properly loop a macro | Excel Programming | |||
For Each Loop not working properly | Excel Programming |