Hi Cat. Are U sure U want to insert the row or just copy it? Here's code for the insert match row to sheet2 then copy match row from sheet1 to sheet2 at same row number (after row has been inserted). HTH. Dave
Code:
Dim Rownumber As Integer
Rownumber = 2 ' insert row number generated by match
Sheets("Sheet2").Cells(Rownumber, 1).Insert Shift:=xlDown
Sheets("Sheet1").Range("A" & Rownumber).EntireRow.Copy _
Destination:=Sheets("Sheet2").Range("A" & Rownumber)
Hi Cat. Are U sure U want to insert the row or just copy it? Here's code for the insert match row to sheet2 then copy match row from sheet1 to sheet2 at same row number (after row has been inserted). HTH. Dave
Code:
Dim Rownumber As Integer
Rownumber = 2 ' insert row number generated by match
Sheets("Sheet2").Cells(Rownumber, 1).Insert Shift:=xlDown
Sheets("Sheet1").Range("A" & Rownumber).EntireRow.Copy _
Destination:=Sheets("Sheet2").Range("A" & Rownumber)
Hey Thanks for the above, How does the code know what the row number is that has been generated by match.
Sheet 2 is the master. The way the macro works up to this point is is does a whole heap of comparisons to decide if parts from Sheet 1 have been removed / updated revisions / updated descriptions etc compared to sheet 2. It then looks at sheet two updates all the values to the new ones and then, does a load more comparisons to determine which parts are new parts and need to be added to sheet 2.
It does a match function to find the row location of the items on sheet 2 within sheet 1.
The Match function is to keep items in the same order, so if something was added to assembly 23, say on row 244 (Sheet 1) it would input that row into row 244 on sheet 2, thus keeping everything where it should.
I really hope that makes sense and I haven't confused things.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.