comparing two list ranges in two workbooks
Posted by Ben on April 11, 2000 11:06 AM
I've come across something i don't understand.
I'm comparing 2 lists (single columns) that are in 2 different workbooks; when i try to set the ranges in code, i keep getting error 1004. now if I manually or code-wise place the two columns next each other on the same workbook, i have no problems.
e.g. this works OK after paste operation:
Set rngFirst = ActiveWorkbook.Worksheets(1).Range(Range("A1"), Range("A1").End(xlDown))
Set rngSecond = ActiveWorkbook.Worksheets(1).Range(Range("B1"), Range("B1").End(xlDown))
but this doesn't:
Set rngFirst = Workbooks("Blah").Worksheets(1).Range(Range("A1"), Range("A1").End(xlDown))
Set rngSecond = Workbooks("Rhubarb").Worksheets(1).Range(Range("A1"), Range("A1").End(xlDown))
can anyone tell me why?