Situarte en una determinada fila al pulsar tecla intro

Realmente para hacer más cómodo el trabajo con el documento de excel me gustaría que se pudiera hacer lo mismo que en la pregunta "Situarte en una determinada fila al hacer doble click" pero tambien con la telcla "intro" al pulsarla.

Así si estoy en un valor de la columna A o B pudiera ir a la fila correspondiente de la hoja "titulos" pulsando "intro".

yo había pensando usar ...

If keyAscii = 13 then

'Por.Dante Amor
    If Not Intersect(Target, Columns("A:B")) Is Nothing Then
        f = Cells(Target.Row, "A")
        If f = 0 Then Exit Sub
        Sheets("titulos").Select
        Sheets("titulos").Rows(f).Select
    End If

End if

Pero no sé en qué tipo de evento o macro usarlo, ni si funcionará realmente.

Lo de usar "intro" es más que nada porque si otra persona usa el excel, y a lo mejor no se plantea usar doble click y pulsa "intro" porque está más acostumbrado.

1 Respuesta

Respuesta
1

H o  l a:

Pon lo siguiente en los eventos de la hoja "busquedas"

Private Sub Worksheet_Activate()
'Por.Dante Amor
    Application.OnKey "{13}", "macro"
End Sub
'
Private Sub Worksheet_Deactivate()
'Por.Dante Amor
    Application.OnKey "{13}"
End Sub
'
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Por.Dante Amor
    If Not Intersect(Target, Columns("A:B")) Is Nothing Then
        Application.OnKey "{13}", "macro"
    Else
        Application.OnKey "{13}"
    End If
End Sub

Pon la siguiente macro en un módulo:

Sub macro()
'Por.Dante Amor
    If ActiveSheet.Name = "busquedas" Then
        If Not Intersect(ActiveCell, Columns("A:B")) Is Nothing Then
            f = Cells(ActiveCell.Row, "A")
            If f = 0 Then Exit Sub
            Sheets("titulos").Select
            Sheets("titulos").Rows(f).Select
        End If
    End If
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas