ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last cell in active row--I know, I'm sorry (https://www.excelbanter.com/excel-programming/420006-re-last-cell-active-row-i-know-im-sorry.html)

Mike

Last cell in active row--I know, I'm sorry
 
Sub lastrow()
ActiveCell.End(xlUp).Select
End Sub

"Greg Snidow" wrote:

Greetings all. I know this question has been asked here many, many times,
but I can not get any of the examples to do exactly what I need. I need to
select the last cell with data on the acive row. So, for example, if I have
cell A1 selected, and there are data in cells A2, A5, and A8, I need a macro
to select A8. If, then, I select B3, and there are data in B1, B3, and B10,
I need it to then select B10. Any ideas? Thank you, and again, I apologize
for the redundant question.

Greg


Greg Snidow

Last cell in active row--I know, I'm sorry
 
Ok, what it does is select vertically, the last cell with data above the
active cell in the same column. I need it to select the last cell in the
active row, or move horizontally to right, to the last cell with data. Does
that make more sense?

"Mike" wrote:

Greg maybe you need to explain a little better cause what you asked to do the
macro i gave you does.

You said "if I have cell A1 selected, and there are data in cells A2, A5,
and A8, I need a macro to select A8"
Sub lastrow()
ActiveCell.End(xlUp).Select
End Sub

"Greg Snidow" wrote:

Mike, thank you so much for the quick reply so late at night, but maybe it is
not 10:00 for you. I found that snippet here a couple of weeks ago, and it
is awesome, but it finds the last cell in a column. I need to find the last
cell in the row. Any ideas?

"Mike" wrote:

Sub lastrow()
ActiveCell.End(xlUp).Select
End Sub

"Greg Snidow" wrote:

Greetings all. I know this question has been asked here many, many times,
but I can not get any of the examples to do exactly what I need. I need to
select the last cell with data on the acive row. So, for example, if I have
cell A1 selected, and there are data in cells A2, A5, and A8, I need a macro
to select A8. If, then, I select B3, and there are data in B1, B3, and B10,
I need it to then select B10. Any ideas? Thank you, and again, I apologize
for the redundant question.

Greg



All times are GMT +1. The time now is 07:40 AM.

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