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: 6
Default compare ranges in different workbooks and copy "not matching values" at bottom of range 1

hi ,

I am trying to compare data in two different workbooks.it should
compare data in A column in book 1 with data in data in A column in
book 2.

if there is no match, then it should add those data not matched into
book1 at the last of A column.

here is my code:

Sub master()

Dim b1 As Workbook

Dim w1 As Worksheet

Dim rCell As Range
Dim LookRange As Range
Application.ScreenUpdating = False

MsgBox ("Select the Subset File location")

Set b1 = Workbooks.Open(Application.GetOpenFilename(, , "Open File
1"))
Set w1 = b1.Worksheets("suppliers")

Set LookRange = Sheets("suppliers").Range("A1",
Range("A65536").End(xlUp))

MsgBox LookRange.Address

For Each rCell In LookRange


' here it give script out of range error.!!!!???????

If WorksheetFunction.CountIf _
(Sheets("pros").Columns(1), rCell.Text) = 0 Then
rCell.Range("A2:C1").Copy _
Destination:=Sheets("pros").Range("A65536").End(xl Up).Offset(1, 0)

End If

Next rCell

Application.CutCopyMode = False

Application.ScreenUpdating = True

Sheets("pros").Range("A1:A65536").HorizontalAlignm ent = xlRight

Sheets("prols").Activate

End Sub


can anyone help in this..?

thanks,

kaza
 
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 two worksheets with "contains" and not "exact" values Fuzzy Excel Worksheet Functions 1 October 4th 09 07:27 AM
problem with Linking workbooks via "copy" and "paste link" Arkitek Excel Discussion (Misc queries) 0 December 19th 06 10:03 PM
Compare to a range of values using "from/to" Lisa O. Excel Discussion (Misc queries) 7 May 23rd 06 07:00 PM
Compare ranges n copy at bottom of first range Kaza Sriram Excel Programming 0 August 5th 04 02:16 PM
copy a range of cells (a row) to the bottom of a "list" Torstein Johnsen Excel Programming 1 November 14th 03 09:57 PM


All times are GMT +1. The time now is 03:40 AM.

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"