ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error getting Row number (https://www.excelbanter.com/excel-programming/321841-error-getting-row-number.html)

Brad K.

Error getting Row number
 
Hello.
I have the follow in part of a sub.


Private Sub Workbook_SheetSelectionChange
..
<code
RowNum = ActiveCell.Row
<code
..
End Sub

The problem is when I select multiple rows I either get error messages or
freeze Excel (2002 w/ XP).
How do I change this so that if multiple rows are selected only then only
the bottom row is looked at for naming my variable.
Thanks in advance,
Brad K

Don Guillett[_4_]

Error getting Row number
 
try

x = Cells(ActiveCell.Row, ActiveCell.Column).End(xlDown).Row
MsgBox x



--
Don Guillett
SalesAid Software

"Brad K." wrote in message
...
Hello.
I have the follow in part of a sub.


Private Sub Workbook_SheetSelectionChange
.
<code
RowNum = ActiveCell.Row
<code
.
End Sub

The problem is when I select multiple rows I either get error messages or
freeze Excel (2002 w/ XP).
How do I change this so that if multiple rows are selected only then only
the bottom row is looked at for naming my variable.
Thanks in advance,
Brad K




Ken Wright

Error getting Row number
 
With Selection
rownum = .Row - 1 + .Rows.Count
End With

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Brad K." wrote in message
...
Hello.
I have the follow in part of a sub.


Private Sub Workbook_SheetSelectionChange
.
<code
RowNum = ActiveCell.Row
<code
.
End Sub

The problem is when I select multiple rows I either get error messages or
freeze Excel (2002 w/ XP).
How do I change this so that if multiple rows are selected only then only
the bottom row is looked at for naming my variable.
Thanks in advance,
Brad K





All times are GMT +1. The time now is 11:48 AM.

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