Find Text then Copy and Paste

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi -
I have data on Sheet1 A:Z. I want to search column A for text that is entered on Sheet2A5. Once that value is found on Sheet1, i want to copy from where its found in A to Z and down 6 rows. So if Sheet2A5 is found in sheet1A30 Sheet1A30:Z36 is copied and pasted to sheet2AB5.

thanks!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How about
Code:
Sub helpexcel()
   Dim Fnd As Range
   
   Set Fnd = Sheets("Sheet1").Range("A:A").Find(Sheets("Sheet2").Range("A5").Value, , , xlWhole, , , False, , False)
   If Not Fnd Is Nothing Then Fnd.Resize(7, 26).Copy Sheets("Sheet2").Range("AB5")
End Sub
 
Upvote 0
Brilliant as usual @Fluff!!

I was kinda close...but not really. It's so easy, yet so hard.





Dim LastRow As Long
LastRow = ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row


Dim Lrng1, Frng1 As Range
Set Lrng1 = ws2.Range("A5")
Set Frng1 = ws1.Range("A1" & LastRow).Find(Lrng1)


If Not Frng1 Is Nothing Then
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

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