Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Compare to columns on two different spread sheet, only pick up the

I have created the macro to check the changes compare to the values in sheet1
vs sheet2, if anything changed more than certain amount, it will be copied
and pasted to another sheet. The thing is I couldn't figure out how to find
out the names only on sheet1 or only on sheet2. for example, if i check
column A on each sheet, how can i find out the names only on sheet1 and only
on sheet2, then i can copy, paste the value to another spread sheet?

Thanks a lot.

Ming
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Compare to columns on two different spread sheet, only pick up the

Finally, I found out answer from Ron's website. Thanks a lot Ron. His website
is http://www.rondebruin.nl

Here's the code, I'm using and hope it could do some help to other people as
well.

Dim AA As String
Dim BB As Long
Dim CC As String
Dim DD As String
Dim DateDD As Date
Dim EE As Double
Dim AAy As String
Dim BBy As Long
Dim CCy As String
Dim DDy As String
Dim DateDDy As Date
Dim EEy As Double
Dim change As Double
Dim val As Range
Dim vStr As String
Dim valFound As Range
Dim valOut As Range
Dim fistadd As String
Dim FindString As String
Dim rng As Range
Dim FindStringy As String
Dim rngy As Range
Dim t as Integer
Dim t1 as Integer
Dim b as Integer

Sheets("DATA-A").Select
For t = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Sheets("DATA-A").Select
Cells(t, "A").Select
AA = Cells(t, "A").Value
BB = Cells(t, "B").Value
CC = Cells(t, "C").Value
DD = Cells(t, "D").Value
DateDD = Cells(t, "E").Value
EE = Cells(t, "F").Value
FindString = Cells(t, "A").Value
Sheets("DATA-B").Select
With Sheets("DATA-B").Columns("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.Goto rng, True
Else
Sheets("Changes").Select
b = Cells(Rows.Count, "a").End(xlUp).Row + 1
Cells(b, "A").Value = AA
Cells(b, "B").Value = BB
Cells(b, "C").Value = CC
Cells(b, "D").Value = DD
Cells(b, "E").Value = DateDD
Cells(b, "F").Value = EE
Cells(b, "G").Value = "New Addition,
please check."
End If
End With


Next t
Sheets("DATA-B").Select
For t1 = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Sheets("DATA-B").Select
Cells(t1, "A").Select
AAy = Cells(t1, "A").Value
BBy = Cells(t1, "B").Value
CCy = Cells(t1, "C").Value
DDy = Cells(t1, "D").Value
DateDDy = Cells(t1, "E").Value
EEy = Cells(t1, "F").Value
FindStringy = Cells(t1, "A").Value
Sheets("DATA-A").Select
With Sheets("DATA-A").Columns("A:A")
Set rngy = .Find(What:=FindStringy, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rngy Is Nothing Then
Application.Goto rngy, True
Else
Sheets("Changes").Select
b = Cells(Rows.Count, "a").End(xlUp).Row + 1
Cells(b, "A").Value = AAy
Cells(b, "B").Value = BBy
Cells(b, "C").Value = CCy
Cells(b, "D").Value = DDy
Cells(b, "E").Value = DateDDy
Cells(b, "F").Value = EEy
Cells(b, "G").Value = "Not shown on
today's list, Please Check"
End If
End With


Next t1


"Ming" wrote:

I have created the macro to check the changes compare to the values in sheet1
vs sheet2, if anything changed more than certain amount, it will be copied
and pasted to another sheet. The thing is I couldn't figure out how to find
out the names only on sheet1 or only on sheet2. for example, if i check
column A on each sheet, how can i find out the names only on sheet1 and only
on sheet2, then i can copy, paste the value to another spread sheet?

Thanks a lot.

Ming

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 the words in columns of the excel sheet MajesticM Excel Discussion (Misc queries) 2 January 29th 08 07:37 PM
How do I print certain (specifics) columns in Excel spread sheet? MariVi Excel Worksheet Functions 3 July 9th 07 09:59 PM
unhide columns a-c on spread sheet SKY Setting up and Configuration of Excel 3 April 8th 06 09:23 PM
Setting borders for two rows and all columns on spread sheet R OLEJAR Excel Worksheet Functions 0 February 1st 06 04:19 PM
Can I add more columns to a spread sheet or is limit 256 columns Piper Excel Discussion (Misc queries) 4 October 9th 05 08:27 PM


All times are GMT +1. The time now is 12:54 PM.

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

About Us

"It's about Microsoft Excel"