View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
DireWolf DireWolf is offline
external usenet poster
 
Posts: 14
Default Search and Compare two Workbooks

ahhh now that makes sense.

As you can tell I don't know very much VB. I can do a bit of php so
I can relate that rule.

When I run the macro I get this error:
runtime error 9, subscript out of range

on this line of code:
Set Ws1 = Workbooks("book1").Sheets("Sheet1")

I'm assuming that it can't set the Ws1 variable as it has a problem
with the workbook?

I have my 3 workbooks (named - book1, book2, book3) open, the
worksheet in each is named "Sheet1". Do I need to define anything
else or is the problem with my workbooks?

Thanks for the help so far.



On Tue, 6 Jan 2004 16:26:52 -0600, mudraker
wrote:

Direwolf


With the code that you pasted in this message It looks like my code has
been word wrapped at some stage.

When a _ is at the end of a line VBA joins the next line of code to
the previous to make up a continous single command



New code has _ added to 2 lines

lWb2Row = Ws2A.Find(What:=Cell.Value, After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Row


Put the Then at the end ot the If statment row

eg If(balh<blahblah) then


If Ws1.Range("b" & Cell.Row) < Ws2.Range("b" & lWb2Row)
Then


---
Message posted from http://www.ExcelForum.com/