Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

find and copy

Posted on 2014-01-08
3
Medium Priority
?
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

704 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