ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Select the first cell of the last row in a range - Excel 2003 (https://www.excelbanter.com/new-users-excel/226353-re-select-first-cell-last-row-range-excel-2003-a.html)

Gary''s Student

Select the first cell of the last row in a range - Excel 2003
 
Is this good enough:

Sub ordinate()
Set r = Selection
nFirstColumn = r.Column
nLastRow = r.Rows.Count + r.Row - 1
Set first_cell_in_last_row = Cells(nLastRow, nFirstColumn)
MsgBox (first_cell_in_last_row.Address)
End Sub

--
Gary''s Student - gsnu200842


"Susan Ramlet" wrote:

A co-worker asked me how to programmatically select the first cell of the
last row in a range in Excel 2003 (Windows XP). We found the Help reference
to selecting the last cell in a range, but we couldn't come up with a good
solution for the first cell in the last row, other than a "SendKeys" type of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**




All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com