LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to find and copy to another sheet

Hello
I haven't posted here for a few years, but i'm stuck with this problem

I have a sheet that contains various parts and numbers along with prices
week by week.(Parts)
Column A has Part
Column B has number
Column C has base number
e.g: Part / 123/ 5c. then columns d onwards have a weekly price value in
them (52)

On Sheet 1 i enter three words and numbers (Part1 in cell A11, First Number
in cell A12 and Base Number in A13.
I then run this macro to search the 'Parts' sheet for an exact match for all
three and the return every weeks price for that part.
As you can see i would need to expand this code for 52 weeks (currently only
6 in the code)
I then need to duplicate this macro to find further 5 parts and return
those prices under the first one which starts at row 13, so my next macro
would target row 14 etc
Is there any way that when the match is found that i can return that entire
Row from the 'Parts' sheet onto sheet 1.therefor cutting down the code i
need.?
Thanks in advance

Paul

I'm using this VB code to do this


Sub findcopy1()
Dim vFind As Variant
Dim lFirstRow As String
Dim rFound As Range

vFind = Sheet1.Range("a11:a13").Value

With Sheet2.Range("A:A")
Set rFound = .Find(vFind(1, 1), LookIn:=xlValues)
If Not rFound Is Nothing Then
lFirstRow = rFound.Row
Do
If rFound.Offset(, 1).Value = vFind(2, 1) And
rFound.Offset(, 2).Value = vFind(3, 1) Then
Worksheets("Sheet1").Range("J13").Value =
..Cells(rFound.Row, "E")
Worksheets("Sheet1").Range("K13").Value =
..Cells(rFound.Row, "F")
Worksheets("Sheet1").Range("L13").Value =
..Cells(rFound.Row, "G")
Worksheets("Sheet1").Range("M13").Value =
..Cells(rFound.Row, "H")
Worksheets("Sheet1").Range("N13").Value =
..Cells(rFound.Row, "I")
Worksheets("Sheet1").Range("O13").Value =
..Cells(rFound.Row, "E")
Exit Sub
End If
Set rFound = .FindNext(rFound)
Loop While Not rFound Is Nothing And rFound.Row lFirstRow
End If
End With

MsgBox "No Data Found"
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find value in sheet 1 and copy matching row from sheet 2 Also Excel Programming 1 January 8th 08 11:49 AM
Macro to find matching date and copy values to another sheet Tiger Excel Discussion (Misc queries) 3 August 13th 07 01:45 PM
Find value from sheet 1 on sheet 2 and copy to an offset from there L. Howard Kittle Excel Programming 3 March 2nd 07 09:32 PM
find value in one sheet use this as the row to copy the value in c Paul Excel Programming 12 April 22nd 06 09:16 AM
how to find and copy values on sheet 2, based on a list on sheet 1 evanmacnz Excel Programming 4 February 7th 05 08:33 PM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"