ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move the cursor to a cell in button click event (https://www.excelbanter.com/excel-programming/331934-move-cursor-cell-button-click-event.html)

Man Utd

Move the cursor to a cell in button click event
 
I have a button would like to do the followings:
User click the button, I want to make a cell to be selected(make it focused)
in a row which is the last row. This last row is not the last row of the
worksheet but the last row of the column who has no value ?

For example:

A B C
Peter 25 11:35pm
John 33 12pm
Mary 23 1:22am

So if the user click the button, the cell A4 should be selected. I want to
simulate as a new record function.




Vasant Nanavati

Move the cursor to a cell in button click event
 
Range("A" & Rows.Count).End(xlUp).Offset(1).Select

--

Vasant

"Man Utd" wrote in message
...
I have a button would like to do the followings:
User click the button, I want to make a cell to be selected(make it

focused)
in a row which is the last row. This last row is not the last row of the
worksheet but the last row of the column who has no value ?

For example:

A B C
Peter 25 11:35pm
John 33 12pm
Mary 23 1:22am

So if the user click the button, the cell A4 should be selected. I want to
simulate as a new record function.






Man Utd

Move the cursor to a cell in button click event
 
Thank you for your reply.
I tried, it seems have strange behaviour to my case:

I have defined 100 rows in which 2 columns have formula inside, and their
contents are empty. When I run this code, the cell selected is the cell
A101but not A1.


Range("A" & Rows.Count).End(xlUp).Offset(1).Select





All times are GMT +1. The time now is 10:13 PM.

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