Hi there
I would be grateful if you could help me with the following issue - I have two large datasets in two sheets and I need to take some data from both and compile a third datasheet in another sheet. I am trying to avoid If clauses and loops because I would wait forever till the computation is done. I therefore wanted to use the FIND function to find out what is the appropriate row in another dataset and then use some values from this row. The code is the following:
x=2
Sheets("Dataset2").Activate
ActiveSheet.Range("AR:AR").Select
ActiveSheet.Range("AR:AR").Activate
Cells.Find(What:=(Sheets("Dataset1").Cells(x, 1).Value), After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
u = ActiveCell.Row
The result should be the value of "u", which will be then used as a row reference, i.e. Cells(u,1)... But I am getting Error 91 - Object variable not set. However, I don't know where it refers to, because the only object in the FIND function is the Cell., which I don't have to define. Or do I?
I would very much appreciate any help here.
Thanks!
Ivan











LinkBack URL
About LinkBacks
Register To Reply
Any other ideas would be very much appreciated!

Just one more question - it can also happen that the value won't be there... In that case, the code shall skip it and move to another x in the Dataset1. Could you please advise how to code it? Sorry for this, but I don't want to play around with your code anymore, since it is working now...

Bookmarks