+ Reply to Thread
Results 1 to 3 of 3

Error getting Row number

  1. #1
    Brad K.
    Guest

    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

  2. #2
    Don Guillett
    Guest

    Re: Error getting Row number

    try

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



    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Brad K." <[email protected]> wrote in message
    news:[email protected]...
    > 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




  3. #3
    Ken Wright
    Guest

    Re: 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." <[email protected]> wrote in message
    news:[email protected]...
    > 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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1