0

I am using the lines:

Dim lastrowmonth as Integer, PMARow As Integer
lastRowMonth = Cells(1 & "," & Rows.Count).End(xlUp).Row
Do While PMARow < lastRowMonth + 1

However it keeps telling me that lastRowMonth = 1and as such wont let me access my code, inside the do while. Any advice here as there are 1400 filled cells in column A and ideally I want to move on to changing 1 to a variable to move through other columns.

Any help would be grand!

1
  • 1
    If you're using Cells, it is Cells(row, column) not the opposite. Commented Feb 13, 2014 at 3:07

2 Answers 2

2

Try this:

lastRowMonth = Cells(Rows.Count,1).End(xlUp).Row

And maybe it would be a good idea to declare lastRowMonth as a Long to be sure because in excel there are more rows than an Integer can take

Sign up to request clarification or add additional context in comments.

1 Comment

No problem @CJones. And, I don't know you but I'm pretty sure you're not an idiot :)
2

You need to change the second line to:

lastRowMonth = Cells(Rows.Count, 1).End(xlUp).Row

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.