Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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
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
Paste data based on multiple criteria Tacrier Excel Worksheet Functions 0 April 11th 08 05:18 PM
Copy/Paste data based on a criteria [email protected][_2_] Excel Programming 3 February 8th 08 10:35 PM
Copy/Paste based on Criteria Dan R. Excel Programming 2 February 5th 07 08:25 PM
copy/paste based on colour criteria gavinM Excel Programming 0 May 11th 04 02:41 AM
Cut & Paste Data into different worksheet based on specific criteria hailnorm[_2_] Excel Programming 2 December 6th 03 10:56 PM


All times are GMT +1. The time now is 06:35 AM.

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"