LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Compare Problem

Hi Folks,

i'm working on comparing column A in two workbooks and having the
differences reported back either to a sheet in workbook1 or a new workbook.
The code below runs without error but does not return any values and i know
there are differences which should be reported.

There is probably something wrong with my comparison but I'm not sure what
it is.

What i'd like to happen is for the macro to find values in column A that do
not appear in both workbooks and return the values for column A, B, and C.

Dim xlsFilePath As String
xlsFilePath = Application.GetOpenFilename
Application.Workbooks.Open xlsFilePath

MsgBox ("Path & File is " & xlsFilePath)
MsgBox ("File is " & ActiveWorkbook.Name)

Set mstrBook = Workbooks("NJ Pay Rate Check.xls")
Set mstrSheet = mstrBook.Sheets("Rate Check")

Set cmprBook = Workbooks(ActiveWorkbook.Name)
Set cmprSheet = cmprBook.Sheets("NJ Union Contract Raise Report")

Set newbk = Workbooks.Add
Set newbk_sht = newbk.Sheets("Sheet1")
NewbkRowCount = 1

With mstrSheet
LastRow = .Range("A200")
For RowCount = 6 To LastRow
If .Range("A" & RowCount) < "" Then
empNum = .Range("A" & RowCount)
With cmprSheet
Set c = .Columns("A:A").Find(what:=empNum, _
LookIn:=xlValues, lookat:=xlWhole)
End With

If c Is Nothing Then
.Rows(RowCount).Copy _
Destination:=newbk_sht.Rows(NewbkRowCount)
NewbkRowCount = NewbkRowCount + 1
End If
End If
Next RowCount
End With

Any help is greatly appreciated.
 
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
How do I compare cells and if FALSE compare to next cell in EXCEL Cindie Excel Worksheet Functions 0 March 24th 06 05:29 PM
Problem with code. (Compare all cells) Metrazal[_46_] Excel Programming 1 March 10th 06 07:34 PM
String compare doesn't compare? Ken Soenen Excel Programming 1 January 16th 06 03:40 PM
Excel VBA - Help with a loop, compare, delete problem rippy Excel Programming 0 February 4th 04 03:38 PM
compare data from one column with another and compare result to yet another Matt Williamson[_3_] Excel Programming 1 September 25th 03 08:54 PM


All times are GMT +1. The time now is 02:51 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"