1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LigneDebut As Integer
Dim LigneMilieu As Integer
Dim LigneFin As Integer
Dim Colonne As Integer
Colonne = ActiveCell.Column
LigneDebut = Cells.Find(What:="production", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Row
LigneMilieu = Cells.Find(What:="logistique", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Row
LigneFin = Cells.Find(What:="totaux", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Row
'sélection de l'étape ou non
If Colonne = 5 And (ActiveCell.Row > LigneDebut And ActiveCell.Row < LigneFin) Then
UserForm1.Show
End If
'pour mettre en gras la ligne sélectionnée
For i = LigneDebut + 1 To LigneFin - 1
If i <> LigneMilieu Then
If Cells(i, 5).Value = "X" Then
With Range(i & ":" & i)
With .Font
.Bold = True
.Color = black
End With
End With
Else
With Range(i & ":" & i)
With .Font
.Bold = False
.Color = RGB(100, 100, 100)
End With
End With
End If
End If
Next
End Sub |
Partager