Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Find, Copy, Past" VBA Code Help in Excel

Status
Not open for further replies.

Kstater30

Technical User
Apr 11, 2006
9
US
I was helped here yesterday creating a "Find" code that was successful. I thought I would be able to modify it based on what little I know but was unsuccessful. Here is the code I used. This is not the code I got yesterday, yesterday was purely a "Find" code which worked great, this is how I modified it to try and accomplish some of what I have described below.

Sub Find()

Dim i As Integer, r As Range
For i=0 To Cells ("Z7")
Set r=Range("D9:L39").Find([cells(17,9+i)])
Next i

End Sub

What I am trying to accomplish in the end is to start off in one table of updates, go to the first item which will always start in Q9 or (17,9) as referred to in the code and then copy the items in that row, look up the first value in that row in Range D9:L39, move one cell over and paste, I'm moving one cell over so as not to paste over the looked up value, if this isn't necessary let me know. I don't have the copy part of the code or the paste part written, I am trying to figure out each piece at a time and then put them together but at the rate I'm going I'll be dead long before I get there. If you can help that would be great.

 
you may try this:
Set r = Range("D9:L39").Find(Cells(9 + i, 17))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The problem with that is that instead of it putting me in the Q column or column 17 it will put me in the I column and will be looking up the wrong info.
 
Really ?
The syntax is: Cells(Rowindex,Columnindex)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You are right, however now when I run the code I get a "Type Mismatch" error. When you do find can you input "cells" code to look up or is there some way I can use the "Find Next" code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top