Cell Focus from another sheet DoubleClick Vba Excel

后端 未结 1 824
北海茫月
北海茫月 2021-01-25 20:39
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
     Dim f As Range
     If Target.Count = 1 Then
        If Not Intersect(Target, Me.R         


        
相关标签:
1条回答
  • 2021-01-25 21:14

    Something like this:

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
         Dim f As Range, wsSearch As Worksheet
         If Target.Count = 1 Then
            If Not Intersect(Target, Me.Range("L:L")) Is Nothing Then
                Set wsSearch = ThisWorkbook.Sheets("Hoja8")
                Set f = wsSearch.Columns(3).Find( _
                                  what:=Target.Value, lookat:=xlWhole)
                If Not f Is Nothing then
                    Cancel = True
                    wsSearch.Activate
                    f.Select
                End If
            End If
        End If
    End Sub
    

    Adjust:

    • Range("L:L") to the column where you are double-clicking
    • "Hoja8" to the sheet name where you want to search
    • Columns(3) to the column where you want to search for the value
    0 讨论(0)
提交回复
热议问题