Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() She said the numbers in Columns X, AE, AH are Life volume coverages. If any one of those fields is filled in with a volume then I need the record to be copied to the LIFE spreadsheet. For example in the first record on the test file column X has 210000. that means that the entire row needs to be copied to the LIFE spreadsheet. That row also has 60 in column AA (which is STD) so it needs to also be moved to the LTD_STD spreadsheet. The second record has X empty but there is 55000 in column AE so it also needs to be moved to the LIFE spreadsheet. There is also a 60 in column AC so the record needs to go to the LTD_STD spreadsheet. I sent this to copy to one or both as indicated from above x,ae,ah to life aa,ac to the other if both, then both Sub life_fileDON() Dim LastRow As Long Dim i As Long 'clear destination rows rowlife = Sheets("LIFE").Cells(Rows.Count, 1).End(xlUp).Row + 1 Sheets("LIFE").Rows("1:" & rowlife).ClearContents rowltd = Sheets("LTD_STD").Cells(Rows.Count, 1).End(xlUp).Row + 1 Sheets("LTD_STD").Rows("1:" & rowltd).ClearContents With Sheet1 LastRow = .Cells(.Rows.Count, "X").End(xlUp).Row For i = 1 To LastRow rowlife = Sheets("LIFE").Cells(Rows.Count, 1).End(xlUp).Row + 1 rowltd = Sheets("LTD_STD").Cells(Rows.Count, 1).End(xlUp).Row + 1 If .Cells(i, "X").Value 0 Or _ .Cells(i, "AE").Value 0 Or _ .Cells(i, "AH").Value 0 Then .Rows(i).Copy Sheets("LIFE").Cells(rowlife, 1) End If If .Cells(i, "AA").Value 0 Or _ .Cells(i, "AC").Value 0 Then .Rows(i).Copy Sheets("LTD_STD").Cells(rowltd, 1) End If Next i End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Don Guillett" wrote in message ... If desired, send your workbook to my address below along with snippets of these msgs, a clear explanation of what you want and examples of before/after -- Don Guillett Microsoft MVP Excel SalesAid Software "Dagonini" wrote in message ... When I try using Bob's it still only pastes the last row on the file into a new spreadsheet. I |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
About my looping | Excel Programming | |||
Looping through folders and using the first file in each folder | Excel Programming | |||
Looping | Excel Programming | |||
Looping | Excel Programming | |||
Looping though *.xls files except for the main consolidation file | Excel Programming |