D
Dagonini
Hi,
I have tried to make some code that will search through a file and
move rows based on certain criteria to new spreadsheets. Code as
follows:
Sub life_file()
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
End Sub
The problem is that I can only make it look at the first row on my
file. There could be a varying number of rows on the file so i can't
just sent a specific range for the macro to look at. I'm not sure how
to make it loop through until all rows have been looked at. Can some
one help?
Thanks!
I have tried to make some code that will search through a file and
move rows based on certain criteria to new spreadsheets. Code as
follows:
Sub life_file()
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
End Sub
The problem is that I can only make it look at the first row on my
file. There could be a varying number of rows on the file so i can't
just sent a specific range for the macro to look at. I'm not sure how
to make it loop through until all rows have been looked at. Can some
one help?
Thanks!