Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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
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
Do Until Loop not functioning properly MB Excel Programming 0 January 30th 07 04:06 PM
Do Until Loop not functioning properly Gord Dibben Excel Programming 0 January 23rd 07 10:30 PM
But not working properly Rao Ratan Singh Excel Discussion (Misc queries) 2 September 14th 06 08:45 AM
how to properly loop a macro brawny_javo Excel Programming 5 May 18th 06 06:22 PM
For Each Loop not working properly oakman[_19_] Excel Programming 13 March 26th 06 11:44 PM


All times are GMT +1. The time now is 10:35 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"