Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare data, and if different, copy to another worksheet
I've been unable to find what I need by searching other posts, but I'm
hopeful someone can help me. We have a simple worksheet for users to enter run time and downtime data for equipment on different production lines. The data is entered in cells A5:H5 and then there is code to move it to the data table (which is autofiltered) beginning in row 9 of the same sheet. The code to move the data entry works fine, but I need to add to it. The users would like to compare A9:D9 with A10:D10 and if different, copy and paste A9:H9 to A9:H9 in a different worksheet. Column C is a date, the other columns are formatted as general. The comparison will not change as new data is always pasted into row 9, one row at a time. If more info is needed, let me know. Any help is very much appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare data, and if different, copy to another worksheet
You will need to change the sheet references for sh and sh2 to your actual
sheet names. Dim sh As Worksheet, sh2 As Worksheet,i As Long Set sh = ActiveSheet Set sh2 = Worksheets("Sheet2") For i = 1 To 4 If sh.Cells(9, i) < sh.Cells(10, i) Then sh.Range("A9:H9").Copy sh2.Range("A9:H9") Exit For End If Next Untested but should work. "bugsyb" wrote in message ... I've been unable to find what I need by searching other posts, but I'm hopeful someone can help me. We have a simple worksheet for users to enter run time and downtime data for equipment on different production lines. The data is entered in cells A5:H5 and then there is code to move it to the data table (which is autofiltered) beginning in row 9 of the same sheet. The code to move the data entry works fine, but I need to add to it. The users would like to compare A9:D9 with A10:D10 and if different, copy and paste A9:H9 to A9:H9 in a different worksheet. Column C is a date, the other columns are formatted as general. The comparison will not change as new data is always pasted into row 9, one row at a time. If more info is needed, let me know. Any help is very much appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare data, and if different, copy to another worksheet
It worked perfectly! Thank you so much!
bugsyb "JLGWhiz" wrote: You will need to change the sheet references for sh and sh2 to your actual sheet names. Dim sh As Worksheet, sh2 As Worksheet,i As Long Set sh = ActiveSheet Set sh2 = Worksheets("Sheet2") For i = 1 To 4 If sh.Cells(9, i) < sh.Cells(10, i) Then sh.Range("A9:H9").Copy sh2.Range("A9:H9") Exit For End If Next Untested but should work. "bugsyb" wrote in message ... I've been unable to find what I need by searching other posts, but I'm hopeful someone can help me. We have a simple worksheet for users to enter run time and downtime data for equipment on different production lines. The data is entered in cells A5:H5 and then there is code to move it to the data table (which is autofiltered) beginning in row 9 of the same sheet. The code to move the data entry works fine, but I need to add to it. The users would like to compare A9:D9 with A10:D10 and if different, copy and paste A9:H9 to A9:H9 in a different worksheet. Column C is a date, the other columns are formatted as general. The comparison will not change as new data is always pasted into row 9, one row at a time. If more info is needed, let me know. Any help is very much appreciated. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare and then copy cell to separate worksheet | Excel Worksheet Functions | |||
Compare two Worksheet and copy the diferent rows to other | Excel Discussion (Misc queries) | |||
Compare worksheets for duplicates and copy data to 1st worksheet | Excel Worksheet Functions | |||
compare name and copy to current worksheet | Excel Programming | |||
compare value in cell and copy cells A through S of same row to a new worksheet | Excel Programming |