Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Fila_Destin As Long, f As Long, Lin As Integer, Texto As String, _
Colu_Destin As Long, c As Long, Col As Integer, Salir AS Boolean
' ---------- El código 1 es este que hizo Antoni
Col = Target.Column
Fil = Target.Row
If Col >= 65 And Col <= 77 And Fil >= 3 And Fil <= 15 Then Cells(6, 13) = Target.Value
If Col >= 65 And Col <= 77 And Fil >= 3 And Fil <= 15 Then Cells(12, 13) = Target.Value
If Col >= 18 And Col <= 30 And Fil >= 3 And Fil <= 15 Then Cells(6, 13) = Target.Value
If Col >= 18 And Col <= 30 And Fil >= 3 And Fil <= 15 Then Cells(12, 13) = Target.Value
' ---&---
Application.EnableEvents = False: Salir=False
If Col = 13 And Fil = 7 Then
Texto = Cells(7, "M")
Colu_Destin = 4
For Fil = 42 To 580 Step 15
For Col = 37 To 134 Step 14
If Texto = Cells(Fil, Col) Then
Range(Cells(Fil,Col), Cells((Fil+12),(Col+12))).Select
Selection.Copy
Range("D42").Select
ActiveSheet.Paste: Salir=True: Exit For
End If
Next
Is Salir Then Exit For
Next
End If
Application.CutCopyMode = False
Application.EnableEvents = True
' ---------- El código 2 es este que hizo Norberto:
Application.Speech.SpeakCellOnEnter = Target.Address = "$S$23"
Col = Target.Column: Application.EnableEvents = False
Fil = Target.Row
If Col >= 18 And Col <= 30 And Fil >= 3 And Fil <= 15 Then Cells(19, 19) = Target.Value
If Col = 13 And Fil = 10 Then
Fila_Destin = 2
Colu_Destin = 32: Texto = Cells(10, "M"): Salir = False
For Fil = 42 To 42 Step 15
For Col = 37 To 1086 Step 14
If Texto = Cells(Fil, Col) Then
For f = 0 To 0
For c = 0 To 13
Cells(f + Fila_Destin, c + Colu_Destin) = Cells(f + Fil, c + Col)
Next
Next
Salir = True: Exit For
End If
Next
If Salir = True Then Exit For
Next
End If
Application.EnableEvents = True
Dim F1 As Long, C1 As Long, F2 As Long, C2 As Long
On Error GoTo Worksheet_SelectionChange_Err
If Target.Cells.Count = 1 Then 'Solo está seleccionada una celda
F1 = CeldaAnterior.Row
C1 = CeldaAnterior.Column
F2 = Target.Row
C2 = Target.Column
If Abs(C1 - C2) + Abs(F1 - F2) > 1 Then 'Si nos movemos más de una celda
Set CeldaAnterior = Target
ElseIf C1 - C2 = 1 Then 'Si nos hemos desplazado una columna a la izquierda
CeldaAnterior.Activate 'Volvemos a la celda
Range("s18") = Range("s18") - 0.5 'restamos 0,5 a la celda s18
ElseIf C2 - C1 = 1 Then 'Si nos hemos desplazado una columna a la derecha
CeldaAnterior.Activate
Range("s18") = Range("s18") + 0.5 'sumamos 0,5 a la celda s18
ElseIf F1 - F2 = 1 Then 'Si nos hemos desplazado una fila arriba
CeldaAnterior.Activate
Range("S18") = Range("S18") + 0.5 '
ElseIf F2 - F1 = 1 Then 'Si nos hemos desplazado una fila abajo
CeldaAnterior.Activate
Range("S18") = Range("S18") - 0.5 'restamos
Else 'Este caso no creo que se dé.
Set CeldaAnterior = Target
End If
End If
Worksheet_SelectionChange_Err:
End Sub