View Full Version : Solved: Help understanding line of code
YellowLabPro
06-10-2006, 03:50 PM
Lastrow = ActSh.Cells(Rows.Count, 1).End(xlUp).Row
Explain each part of this code please. I have a general idea of what it is doing, selecting the last row of code w/ data and selecting moving up to avoid missing data in non-contiguous cells.
YLP
Jacob Hilderbrand
06-10-2006, 04:06 PM
Lastrow is a variable that will hold this value.
ActSH is an object that was (presumably) set to a certain worksheet.
Cells is a way to refer to a specific cell on the worksheet by refering to the cell row, then the cell column. In this case, the row will be 65536 (since that is the current count of rows for an Excel worksheet), and 1 referd to column A. So this is the cell A65536.
End(xlUp) will move the reference up. Assuming that A65536 is blank, then it will move up, skipping all blank cells and come to the first non-blank cell encountered.
.Row will return the row of the cell we get after the End(xlUp).
Basically what this does is get the last row used in a certain column.
YellowLabPro
06-10-2006, 04:20 PM
Thanks Jake,
YLP
Jacob Hilderbrand
06-10-2006, 06:46 PM
You're Welcome :beerchug:
Take Care
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.