+ Reply to Thread
Results 1 to 12 of 12

Default cursor postion

Hybrid View

SVTF Default cursor postion 04-13-2010, 08:22 AM
tony h Re: Default cursor postion 04-13-2010, 09:22 AM
SVTF Re: Default cursor postion 04-13-2010, 12:46 PM
shg Re: Default cursor postion 04-13-2010, 01:11 PM
SVTF Re: Default cursor postion 04-13-2010, 01:36 PM
SVTF Re: Default cursor postion 04-13-2010, 04:14 PM
SVTF Re: Default cursor postion 04-14-2010, 08:09 AM
tony h Re: Default cursor postion 04-14-2010, 09:48 AM
  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Default cursor postion

    Hey,

    Wondering if there is a way to do this ...

    I have a workbook with 11 tabs - Lets say they are named 1 thru 11

    After entering data into a row on tab 1 (or any tab) and then I go to tab 5 (or any tab)

    I would like the cursor postion to high light the 1st empty blank cell in coulmn B on tab 1 or any tab I just left.

    Clear as mud?
    Last edited by SVTF; 05-01-2010 at 10:58 PM.

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Default cursor postion

    in the worksheet_activate event for each sheet try:
    Private Sub Worksheet_Activate()
        Dim rng As Range
        Set rng = Range("B1").End(xlDown)
        rng.Offset(1).Select
    End Sub


    click on the * Add Reputation if this was useful or entertaining.

  3. #3
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Default cursor postion

    Quote Originally Posted by tony h View Post
    in the worksheet_activate event for each sheet try:
    Private Sub Worksheet_Activate()
        Dim rng As Range
        Set rng = Range("B1").End(xlDown)
        rng.Offset(1).Select
    End Sub
    Thanks.

    The above works per say ...

    Data starts at B5 ... lets say I have items filled up to B10 ...

    I click next tab and go back the cursor goes to B5.

    Is there a way to tweak it to look for 1st blank cell in B ?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Default cursor postion

    You could put this in each sheet module:
    Private Sub Worksheet_Activate()
        Dim r As Range
    
        On Error Resume Next
        
        With Me
            Set r = .Columns("B").SpecialCells(xlCellTypeBlanks)
            If r Is Nothing Then
                .Cells(.Rows.Count, "B").End(xlUp)(2).Select
            Else
                r(1).Select
            End If
        End With
    End Sub
    Or this in the ThisWorkbook module
    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
        Dim r As Range
    
        On Error Resume Next
        
        With Sh
            Set r = .Columns("B").SpecialCells(xlCellTypeBlanks)
            If r Is Nothing Then
                .Cells(.Rows.Count, "B").End(xlUp)(2).Select
            Else
                r(1).Select
            End If
        End With
    End Sub
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Default cursor postion

    The above did not seem to move the cursor at all.
    Last edited by shg; 04-13-2010 at 01:42 PM. Reason: deleted quote

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Default cursor postion

    Post a workbook with the code installed that doesn't work.

  7. #7
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Default cursor postion

    After the code below was added:

    Private Sub Worksheet_Activate()
        Dim r As Range
    
        On Error Resume Next
        
        With Me
            Set r = .Columns("B").SpecialCells(xlCellTypeBlanks)
            If r Is Nothing Then
                .Cells(.Rows.Count, "B").End(xlUp)(2).Select
            Else
                r(1).Select
            End If
        End With
    End Sub
    The Microsoft Visual Basic Window opens (no sheets) - close it off and it comes back after approx 10 mins?

  8. #8
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Default cursor postion

    Anyone have a suggestion on the above?

  9. #9
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Default cursor postion

    are you saving in compatability mode it is slower) but woudn't expect that much difference.

+ 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