Solved

find and copy

Posted on 2014-01-08
3
201 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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

914 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now