Tweak code to copy several cells not just one

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,477
Office Version
  1. 2016
Platform
  1. Windows
Hi all

I have the following code given to me that I'd like changed slightly, but need help

The code will search for a matching phrase (in this example "Amazon") through column B and then copy the cell into next row of row Z

Instead of just the text in column C being copied, I'd like C:F copied...

VBA Code:
Sub New_Sort()

Sheets("Statement").Select
Range("C:C").Select
    Selection.Replace What:="-", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
        Range("E1").Select

Set mycell = Sheets("Statement").Range("B:B").Find(What:="*Amazon*") 'Amazon
While Not mycell Is Nothing
mycell.Offset(0, 1).Copy Range("Z65536").End(xlUp)(2)
mycell.clear
Set mycell = Range("B:B").FindNext
Wend

TIA
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,231
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
mycell.Offset(0, 1).Resize(, 4).Copy Range("Z65536").End(xlUp)(2)
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,231
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,923
Messages
5,621,622
Members
415,848
Latest member
LCC

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
Top