Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have data on one sheet "SJournal" that I need to copy or move ont another sheet "Invoice". I also have a condidtion that I need to meet Column "A" of "Sjournal" must match column "B" of "Invoice" and th matches will be on different rows. For example: "Sjournal" may have the data 16791 on row 12 (12, "A") and "Invoice may have the data 16791 on row 67 (67, "B"). If the data matches then I want t copy rows "J" "K" "L", & "M" to "Invoice". Following is the code I have: Dim t As Long Dim jrnlArr As Variant Dim invArr As Variant jrnlArr = Sheets("SJournal").Range("A1:M9999") invArr = Sheets("Invoice").Range("A1:M9999") For t = 1 To 9999 If jrnlArr(t, 1) = invArr(t, 2) Then invArr(t, 10) = jrnlArr(t, 10) invArr(t, 11) = jrnlArr(t, 11) invArr(t, 12) = jrnlArr(t, 12) invArr(t, 13) = jrnlArr(t, 13) End If Next t Sheets("Invoice").Range("A1:M9999") = invArr The two problems, I think I have: (1) I believe the above code require the match to be on the same rows. 2) "SJournal" will have 4 matches t 1 "Invoice" match so my data will be over-written. Example "Invoice" rows: "A" "B" "C" "D" 2/5/06 16771 CUSTOM MOULDING LLC 216.26 2/5/06 16772 VULCAN THREADED PRODUCTS, Inc. 36.81 2/5/06 16773 VULCAN THREADED PRODUCTS, Inc. 51.29 2/5/06 16774 VULCAN THREADED PRODUCTS, Inc. 19.79 Sample "SJournal" rows: 16771 112.83 16771 28.21 16771 75.22 16772 11.33 16772 2.83 16772 22.65 16773 15.78 16773 3.95 16773 31.56 16774 6.09 16774 1.52 16774 12.1 -- Metraza ----------------------------------------------------------------------- Metrazal's Profile: http://www.excelforum.com/member.php...fo&userid=3164 View this thread: http://www.excelforum.com/showthread.php?threadid=51693 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving Data between sheets in the same workbook and moving data between Workbooks. | Excel Worksheet Functions | |||
Referencing Problem with moving cells | Excel Discussion (Misc queries) | |||
similar problem to moving to next cell | New Users to Excel | |||
Copying and moving matching data problem | Excel Programming | |||
moving cursor, may solve big problem | Excel Programming |