View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default 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.