1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub CommandButton1_Click()
ImprimeSelection ' à écrire
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
'Liste déroulante
If Target.Address = "$B$1" Then
CommandButton1.Caption = "Impresion " & vbCrLf & "du tableau " & Target
x = Target.Value
y = Application.Match(x, [H8:H40], 0)
If IsError(y) Then
MsgBox x & " non trouvé"
Else
MsgBox x & " trouvé à la ligne H" & y
' On vérifi que le numéro trouvé est bel et bien précédé par le mot "Récap N°"
If Range("G" & y).Value = "Récap N°" Then
Range("G" & y).CurrentRegion.Select
Exit Sub
End If
'Mais ca ne marche pas !!!
End If
End If
End Sub |
Partager