Solved

find and copy

Posted on 2014-01-08
3
192 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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
Comment Utility
Rgonzo1971 where I paste it to will vary but your solution works great. Thanks
0
 

Author Comment

by:Jagwarman
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
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…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

762 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

15 Experts available now in Live!

Get 1:1 Help Now