Solved

find and copy

Posted on 2014-01-08
3
223 Views
Last Modified: 2014-01-09
I am looking for some vba code that will find the word Stock the copy all cells below that contain data and then to the right

i.e. It cell A5 contains Stock and all cells down to A16 have data and cells right to F15 have data copy A5:A16

Thanks
0
Comment
Question by:Jagwarman
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39765864
HI,

I don't understand where you want to paste them

Sub Makro1()
    Set FoundCell = Cells.Find(What:="Stock", After:=Range("A1"), LookIn:=xlFormulas, LookAt _
        :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False)
    Range(FoundCell, Cells(FoundCell.End(xlDown).Row, FoundCell.End(xlToRight).Column)).Copy
 
End Sub

Open in new window

Regards
0
 

Author Comment

by:Jagwarman
ID: 39767573
Rgonzo1971 where I paste it to will vary but your solution works great. Thanks
0
 

Author Comment

by:Jagwarman
ID: 39768245
Rgonzo1971

Nothing is ever simple is it :-)

I have used this on another file and it is not doing what I thought it was going to do.

The file I am now working on has the same word in A1 G1 and H1 so it goes to G1 and copies from there.

Probably my fault, I need it to start from the first occurance [in this case A1] so if A1 did not have the the word I am looking for and the first occurance was G1 that would be ok.

Can you make the amendment for me pleae.

Many thanks
Regards
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question