rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 574
- Office Version
- 365
- Platform
- Windows
I have a large list of companies (1800+ rows) that I would like to search to see if the company added is in my list. If not, I want to add it. My code is listed below, but it takes quite a while to get through and then crashes on the Activecell.offset line in the do loop. What can I do to make this work.
The code after this do loop will add the new company to the list. Please tell me why it crashes in the middle on the "ActiveCell.Offset(1, 0).Select" line. I get a Run-time error '1004' Application-defined or object-defined error.
Thanks for the help,
Robert
Code:
Sheets("Data").Range("C1").Select
Do
If ActiveCell.Value = Sheets("Data").Range("AA1").Value Then
Exit Do
ElseIf ActiveCell.Value <> Sheets("Data").Range("AA1").Value Then
ActiveCell.Offset(1, 0).Select
End If
Loop
The code after this do loop will add the new company to the list. Please tell me why it crashes in the middle on the "ActiveCell.Offset(1, 0).Select" line. I get a Run-time error '1004' Application-defined or object-defined error.
Thanks for the help,
Robert