Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    1

    Unanswered: Want to move to another sheet on doubleclicking a cell

    Hi
    I have a small problem. I need to move to another sheet's A1 cell, on double clicking a cell in sheet1.
    I've tried my best but could not find an event for a cell. Please help

    Regards
    Sayyed
    Last edited by suboor_2000; 01-03-06 at 09:47.

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    Howdy, and welcome to the board.

    Do you mean like a hyperlink? Click cell A1 on Sheet1. Then go to Insert > Hyperlink. In the resulting dialog box, on the left select "Place in this document". Then on the right, select the sheet where you want to go and above that type in the cell where in that new sheet you want to be.

    HTH
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  3. #3
    Join Date
    Feb 2004
    Posts
    533
    Quote Originally Posted by suboor_2000
    Hi
    I need to move to another sheet's A1 cell, on double clicking a cell in sheet1.
    Place this code in the VB of the Worksheet you wan to have the double click action on. The 'If' statement is used to limit the range of the doubleclick action.

    Code:
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
            If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
                Sheet2.Activate
                ActiveSheet.Range("A1").Select
            Else
                Exit Sub
            End If
    End Sub
    
    ' You can also refer to a specific range this way for the If condition
    If Target.Column = 1 Then
    ~

    Bill

  4. #4
    Join Date
    Feb 2006
    Posts
    113
    I need to move to another sheet's A1 cell, on double clicking a cell in sheet1.
    A slight variation on Bill's posting,

    Code:
    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
          ByVal Target As Range, Cancel As Boolean)
    
        'I've assumed Sheet1 is the code name. If it is the actual sheet name
        'then change the test to
        'If Sh.Name = "Sheet1" Then
        If Sh.CodeName = "Sheet1" Then
            
            Cancel = True
            
            With Sheet2     'The code name of the sheet you want to go to.
                .Activate
                .Range("A1").Select
            End With
        End If
    
    End Sub

Posting Permissions

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