ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying Beginning and Ending Rows in a Selected Range (https://www.excelbanter.com/excel-programming/401815-identifying-beginning-ending-rows-selected-range.html)

JR_06062005[_2_]

Identifying Beginning and Ending Rows in a Selected Range
 
Is there a way in VB to identify the beginning and ending rows in a selected
range. The command below gives the address:

ActiveWindow.RangeSelection.Address

But what I want to do is to determine how many rows (and perhaps columns)
are in a selected range.

Mike H

Identifying Beginning and Ending Rows in a Selected Range
 
Maybe

Sub Macro2()

x = Selection.Rows.Count
y = Selection.Columns.Count
MsgBox x & " Rows. " & y & " Columns."

End Sub

Mike

"JR_06062005" wrote:

Is there a way in VB to identify the beginning and ending rows in a selected
range. The command below gives the address:

ActiveWindow.RangeSelection.Address

But what I want to do is to determine how many rows (and perhaps columns)
are in a selected range.


JR_06062005[_2_]

Identifying Beginning and Ending Rows in a Selected Range
 
Thanks. That did the trick.

"Mike H" wrote:

Maybe

Sub Macro2()

x = Selection.Rows.Count
y = Selection.Columns.Count
MsgBox x & " Rows. " & y & " Columns."

End Sub

Mike

"JR_06062005" wrote:

Is there a way in VB to identify the beginning and ending rows in a selected
range. The command below gives the address:

ActiveWindow.RangeSelection.Address

But what I want to do is to determine how many rows (and perhaps columns)
are in a selected range.



All times are GMT +1. The time now is 03:02 AM.

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