Cells.count

Tucker2008

New Member
Joined
Aug 19, 2013
Messages
37
Office Version
  1. 2013
Platform
  1. Windows
Can somebody please explain what this is doing is layman's terms?

Cells(Rows.Count, PageUp.Column).End(xlUp)
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
As it is - nothing as there's a syntax error with it.

What do you want it to do?
 
Upvote 0
It looks like the code is being used to find the last row of data in the same column that the range PageUp is in.

It does that by going to the very last cell in the column and moving up, just like if you were to use END+UP ARROW from the bottom row.


However there must be more to it, perhaps something like this.
Code:
LastRow = Cells(Rows.Count, PageUp.Column).End(xlUp).Row
 
Upvote 0
Thanks Norie. I was going to say it was to return the last row in a particular column but wanted to see what the value in cell C2 was first. Without knowing what was being assigned to the PageUp variable your code could return an error too.

Tucker2008 - to find the last row in Col A you could use this:

Code:
Option Explicit
Sub Macro1()

    Dim LastRow As Long

    LastRow = Cells(Rows.Count, "A").End(xlUp).Row

End Sub

Does that help?

Robert
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top