troubleshooting Question

Unexpected 'Object variable or With block variable not' error

Avatar of John Carney
John CarneyFlag for United States of America asked on
Microsoft Excel
7 Comments2 Solutions368 ViewsLast Modified:
Please look at the two code snippets below. The script containing the first one (Column D) executes perfectly. But when I step htrough the second one, I get an'Object variable or With block variable not set' error. Why is that, and how do I fix it?

Thanks,
John
THIS ONE WORKS:
Dim top As Range, btm As Range
Set top = [D6].EntireRow
Set btm = Columns("D:D").Find(What:=[D5].Value, After:=Cells(6, 4), LookIn:=xlValues, LookAt:=xlWhole).Offset(-1, 0)

THIS ONE JAMS ON THE LAST LINE:
Dim top As Range, btm As Range
Set top = [N6].EntireRow
Set btm = Columns("N:N").Find(What:=[N5].Value, After:=Cells(6, 14), LookIn:=xlValues, LookAt:=xlWhole).Offset(-1, 0)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros