Do until loop

Hi,

I have a loop

Do Until Rows(ActiveCell.Row) = EndOfRows

At the beginning of the sub i declared

Dim EndOfRows As Long

EndOfRows = Range("C" & Rows.Count).End(xlUp).Row


I get a type mismatch error

Why is this?

Thanks
Seamus
Seamus2626Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CluskittCommented:
Do Until ActiveCell.Row = EndOfRows

You can't compare a type Row with a type Long.
0
Seamus2626Author Commented:
Whats the solution? I want to declare the last row and loop until that condition is met

Thanks
Seamus
0
IanThCommented:
can you cast it to a long
0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Seamus2626Author Commented:
"can you cast it to a long"


Im not sure what that means Ian?

Thanks
Seamus
0
StephenJRCommented:
This maybe?
Dim EndOfRows As Long

EndOfRows = Range("C" & Rows.Count).End(xlUp).Row

Do Until ActiveCell.Row = EndOfRows
'
Loop

Open in new window

0
Seamus2626Author Commented:
perfect!

thanks
Seamus
0
CluskittCommented:
That is exactly what I said in my post. I presented the necessary change for it to work and then explained why it wasn't workin before.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StephenJRCommented:
Fair point, I had missed that.
0
Seamus2626Author Commented:
Thanks and Apologies Cluskitt, i should have seen that.

Thanks too Stephen for your comment

Seamus
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.