Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
cut paste row to end of WB based on criteria
I am trying to cut a row of data that has either a blank cell in column G or
column H and paste the whole row to the first blank row at the end of the active worksheet. the code I am trying is as follows: With ActiveSheet lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 1 Step -1 If Trim(.Cells(i, 8).Value) = "" _ Or Trim(.Cells(i, 7).Value) = "" Then .Cells(i, 1).EntireRow.Cut Range("A65536").End(xlUp).Select r = Selection.Row + 1 Range("A" & r).Select.EntireRow.Paste End If Next i End With I am getting an object required error. Any help is always appreciated. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
cut paste row to end of WB based on criteria
See if this will work
With ActiveSheet lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 1 Step -1 If Trim(.Cells(i, 8).Value) = "" _ Or Trim(.Cells(i, 7).Value) = "" Then .Cells(i, 1).EntireRow.Cut .Range("A65536").End(xlUp).Select r = Selection.Row + 1 .Range("A" & r).Insert End If Next i End With "aileen" wrote: I am trying to cut a row of data that has either a blank cell in column G or column H and paste the whole row to the first blank row at the end of the active worksheet. the code I am trying is as follows: With ActiveSheet lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 1 Step -1 If Trim(.Cells(i, 8).Value) = "" _ Or Trim(.Cells(i, 7).Value) = "" Then .Cells(i, 1).EntireRow.Cut Range("A65536").End(xlUp).Select r = Selection.Row + 1 Range("A" & r).Select.EntireRow.Paste End If Next i End With I am getting an object required error. Any help is always appreciated. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
cut paste row to end of WB based on criteria
Worked perfectly. Thank you!
"JLGWhiz" wrote: See if this will work With ActiveSheet lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 1 Step -1 If Trim(.Cells(i, 8).Value) = "" _ Or Trim(.Cells(i, 7).Value) = "" Then .Cells(i, 1).EntireRow.Cut .Range("A65536").End(xlUp).Select r = Selection.Row + 1 .Range("A" & r).Insert End If Next i End With "aileen" wrote: I am trying to cut a row of data that has either a blank cell in column G or column H and paste the whole row to the first blank row at the end of the active worksheet. the code I am trying is as follows: With ActiveSheet lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 1 Step -1 If Trim(.Cells(i, 8).Value) = "" _ Or Trim(.Cells(i, 7).Value) = "" Then .Cells(i, 1).EntireRow.Cut Range("A65536").End(xlUp).Select r = Selection.Row + 1 Range("A" & r).Select.EntireRow.Paste End If Next i End With I am getting an object required error. Any help is always appreciated. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste data based on multiple criteria | Excel Worksheet Functions | |||
Copy/Paste data based on a criteria | Excel Programming | |||
Copy/Paste based on Criteria | Excel Programming | |||
copy/paste based on colour criteria | Excel Programming | |||
Cut & Paste Data into different worksheet based on specific criteria | Excel Programming |