Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
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
Compare and then copy cell to separate worksheet Matt Excel Worksheet Functions 1 February 6th 09 11:22 PM
Compare two Worksheet and copy the diferent rows to other CC Excel Discussion (Misc queries) 0 December 10th 08 04:48 PM
Compare worksheets for duplicates and copy data to 1st worksheet Monique Excel Worksheet Functions 2 September 12th 07 07:50 PM
compare name and copy to current worksheet Mikke Excel Programming 0 May 13th 06 04:03 PM
compare value in cell and copy cells A through S of same row to a new worksheet johnnyray00 Excel Programming 1 November 13th 03 03:56 PM


All times are GMT +1. The time now is 06:31 PM.

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

About Us

"It's about Microsoft Excel"