ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select last cell in Selection (https://www.excelbanter.com/excel-discussion-misc-queries/192933-select-last-cell-selection.html)

jlclyde

Select last cell in Selection
 
I am trying to write some VBA to use the row number of the last cell
in selection as a variable. How do you set this as a variable?

Thanks,
Jay

Mike

Select last cell in Selection
 
Const whatColumn as String = "A"
Dim lastrow
lastrow = Range(whatColumn & Rows.Count).End(xlUp).Row

"jlclyde" wrote:

I am trying to write some VBA to use the row number of the last cell
in selection as a variable. How do you set this as a variable?

Thanks,
Jay


Mike H

Select last cell in Selection
 
Hi

myrow = Selection(Selection.Count).Row

Mike

"jlclyde" wrote:

I am trying to write some VBA to use the row number of the last cell
in selection as a variable. How do you set this as a variable?

Thanks,
Jay


jlclyde

Select last cell in Selection
 
On Jun 27, 3:04*pm, Mike H wrote:
Hi

myrow = Selection(Selection.Count).Row

Mike



"jlclyde" wrote:
I am trying to write some VBA to use the row number of the last cell
in selection as a variable. *How do you set this as a variable?


Thanks,
Jay- Hide quoted text -


- Show quoted text -


Mike H. ,
That is way too simple. I am glad I know that now.

Thank you for that.

Jay

Mike H

Select last cell in Selection
 
Your welcome and thanks for the feedback

Mike

"jlclyde" wrote:

On Jun 27, 3:04 pm, Mike H wrote:
Hi

myrow = Selection(Selection.Count).Row

Mike



"jlclyde" wrote:
I am trying to write some VBA to use the row number of the last cell
in selection as a variable. How do you set this as a variable?


Thanks,
Jay- Hide quoted text -


- Show quoted text -


Mike H. ,
That is way too simple. I am glad I know that now.

Thank you for that.

Jay



All times are GMT +1. The time now is 02:40 PM.

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