Copy entire row into column

justkodian

New Member
Joined
Jun 5, 2019
Messages
2
I have a spreadsheet with items similar to below:
#item codeitem descriptionitem sizenotescost
001Tool Box Prepack1UN47.75
CONTAINS:0001Screwdriver1UN2.79
002Ladder1UN87.79

<tbody>
</tbody>

I am trying to create a macro that will search for the word "Prepack" in column C and when it finds it to cut the entire row(s) below it that have "CONTAINS:" in column A..the trickier part is they need to be pasted next to end of the row with "Prepack"

so it would look like this after:
#item codeitem descriptionitem sizenotescost
001Tool Box Prepack1UNCONTAINS:0001Screwdriver1UN2.79
002Ladder1UN87.79

<tbody>
</tbody>

****** id="cke_pastebin" style="position: absolute; top: 197px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
item codeitem descriptionitem sizenotescost
001Tool Box Prepack1UN47.75

<tbody>
</tbody>
</body>And if there are multiple rows below the prepack with CONTAINS: all of the rows get cut and pasted beside

Thanks for the help.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try this

Code:
Sub Copy_entire_row()
    Dim i As Long
    For i = Range("C" & Rows.Count).End(xlUp).Row To 2 Step -1
        If LCase(Cells(i, "C").Value) Like "*" & LCase("Prepack") & "*" Then
            Range(Cells(i + 1, "A"), Cells(i + 1, "F")).Copy Cells(i, "G")
            Rows(i + 1).Delete
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

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