+ Reply to Thread
Results 1 to 5 of 5

How would I identify why row my cursor is on?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-21-2012
    Location
    illinois
    MS-Off Ver
    Excel 2010
    Posts
    242

    How would I identify why row my cursor is on?

    What I'm trying to do is if I am on the last row of a range. I want to go up one row.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How would I identify why row my cursor is on?

    if Activecell.Row=rng.rows.count then activecell.offset(-1,0).select

    something like that would be a good start, rng needs to be defined, so "set rng=activesheet.range("A1:A20")" for instance

    Put this in the worksheet selection change.

  3. #3
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: How would I identify why row my cursor is on?

    =ROW() will tell you what row you are at
    = COLUMN() will tell you which column you are at
    Click on star (*) below if this helps

  4. #4
    Forum Contributor
    Join Date
    09-21-2012
    Location
    illinois
    MS-Off Ver
    Excel 2010
    Posts
    242

    Re: How would I identify why row my cursor is on?

    Nathansav, even though they are equal the select isnt being executed any ideas?

    If ActiveCell.row = Range("seqNum").Rows.Count Then
    
    ActiveCell.Offset(-2, 0).Select
    
    End If

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How would I identify why row my cursor is on?

    I've just tried it and it works, have you put it in the worksheet_selectionchange event?

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ActiveCell.Row = Range("N").Rows.Count Then
    ActiveCell.Offset(-2, 0).Select
    End If
    End Sub

+ 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