Cut and Paste entire Row to another sheet

trevor2524

New Member
Joined
Jul 24, 2013
Messages
13
Hello, I'm trying to figure out how to cut and paste an entire row to a certain sheet based on column I in sheet 1. If it contains the word newspaper it will then be transferred to the newspaper sheet. I have TV and radio as other categories. It will only search for rows that are not colored red in sheet 1 based on column A. After it cuts the rows it will then delete the row and move everything up one and then check the next available cell. Any help on this would be greatly appreciated.
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hello, I'm trying to figure out how to cut and paste an entire row to a certain sheet based on column I in sheet 1. If it contains the word newspaper it will then be transferred to the newspaper sheet. I have TV and radio as other categories. It will only search for rows that are not colored red in sheet 1 based on column A. After it cuts the rows it will then delete the row and move everything up one and then check the next available cell. Any help on this would be greatly appreciated.

If the cell fill color is by conditional format rather than regular fill, then this code fails.
Code:
Sub news()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, rng As Range, c As Range
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Sheets("newspaper") 'Edit sheet name
lr = sh1.Cells(Rows.Count, "I").End(xlUp).Row
Set rng = sh1.Range("I2:I" & lr)
    For Each c In rng
        If LCase(c.Value) = "newspaper" And sh1.Range("A" & c.Row).Interior.ColorIndex <> 3 Then
            c.EntireRow.Copy sh2.Cells(Rows.Count, 1).End(xlUp)(2)
            Rows(c.Row).Delete
        End If
    Next
End Sub
 
Upvote 0
It's done by regular fill through another macro. Which portion of your code can I change to make it work? Thanks again.
 
Upvote 0
It's done by regular fill through another macro. Which portion of your code can I change to make it work? Thanks again.

If it is regular fill, then it should work as is.

Only conditional Formatting fill would cause a problem, because colors per se are not detectable if established by CF. For whatever reason, they are on a different level in the application. Chip Pearson has an article about it on his website. The CF cells have to be detected by the same criteria that causes them to set the colors.
 
Upvote 0

Forum statistics

Threads
1,216,566
Messages
6,131,437
Members
449,652
Latest member
ylsteve

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top