|
-
Apr 30th, 2003, 04:17 PM
#1
Thread Starter
Junior Member
Comparing data values between worksheets *resolved*
I have a database that has two buttons that imports data from a table to a worksheet in excel. Each button copies different data to different worksheets.
My problem is that I have this data and I need to compare them for non duplicates and output that result in a third worksheet. An example will be given.
Worksheet 1
1
2
3
4
6
7
Worksheet 2
1
2
3
4
5
6
I need to compare worksheet 2 to worksheet 1 so that in worksheet 3 it gives me
5
I'm tried racking my brains on how to do this in excel, but I can't figure it out for the life on me. I know what i need to do but I don't know the right way about it
Puedsocode
If cells in Sheet2 is Not Equal to cells in Sheet 1 Then
Ouput result to worksheet3
End If
Any help would be great
Thanks
Last edited by Decosta; May 1st, 2003 at 11:16 AM.
-
May 1st, 2003, 05:02 AM
#2
As fas as your pseudocode, it should look like this:
VB Code:
For i=1 to 10
For j= 1 to 10
If ActiveWorkbook.sheets("Sheet1").Cells(i,j).Value <> ActiveWorkbook.sheets("Sheet2").Cells(i,j).Value Then
ActiveWorkbook.sheets("Sheet3").Cells(i,j).Value = ActiveWorkbook.sheets("Sheet1").Cells(i,j).Value
End If
Next j
Next i
But that does not match your example!
It will put an entry in Sheet3 if Sheet1 does not match Sheet2, an entry is made into the same cell in Sheet3.
In your example Sheet3 would get entries in the row 5 and row 6!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 1st, 2003, 11:16 AM
#3
Thread Starter
Junior Member
I went back and used Access to compare (used the wizard).. I just hate when you had the answer at the start.. But oh well, live and learn.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|