• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Compile Error: Expected Function or Variable

Shailender

Member
Hello All,

i have a problem in the code when i try to run the code Lastr = Sheets("Sheet3").Cells(rows.Count, Ac).End(xlUp).Row, in these case i am trying to select entire column including blank rows. But when i am trying to find last row with the same method, it shows an error message Compile error: Expected function or variable.

Please anyone help me out.

Thank you in advance.
 
Hi Yasserkhalil,

Thank you for your reply. But my question is when i write a code to find last row, it is showing an error message. It is getting struck nears ROWS, and showing the above mentioned Debug.
 
Compare his code to your's.

Basically, when referencing column in .Cells() you need to either reference it using column number or nest it in "". Otherwise you'll receive error message.

Code:
Lastr = Sheets("Sheet3").Cells(Rows.Count, 29).End(xlUp).Row
 
Hi All,

I am able to run the code as mentioned in the above comments, mightbe i am facing an issue in that particular sheet. I did it in the new sheet.

Thank you for your time and patience.
 
Back
Top