Avatar of vegas86
 asked on

Macro to search for text then copy and paste range to another sheet

I have a spreadsheet that I would like to create a macro for, I have searched the internet and can’t seem to find what I would like.

What I would like is for the macro to search column I on sheet 1 for the specific text string “your name goes here”
When it finds the text string I would like it to copy that row and then 19 rows under that so 20 all up, I want it to copy the entire row not just a range and then paste the results one after the other down the page on sheet 2.

Can this be done?
Microsoft Excel

Avatar of undefined
Last Comment

8/22/2022 - Mon
Anne Troy

I won't be able to program this myself, but the following answers will help the real coder(s):

--What row to begin pasting on sheet 2? First row, first blank row, or a specific row?
--Do you want to just copy it? Or move it?
--Do you need a dialog to ask you what the string will be each time? Or is it the same string each time? (i.e., is it always "your name goes here"?)
--You said "paste the results". Do you mean paste the data or are is there formulas and you want to paste the resulting values?

And...it can definitely be done.

thanks dreamboat, to answer your questions:

- It can start on the first row to being pasting on sheet 2
- Either or, which ever is easiest. Probably copy
-It will always be "your name goes here" it will not change
- I mean paste the results, there are formulas but I figured just pasting will paste both formulas and data.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question


This works perfectly!!

Thank you, Thank you, THANK YOU!!!

You have saved my day!

Your help has saved me hundreds of hours of internet surfing.