M
Martial
Guest
Bonjour au forum.
Qui pourrait m'aider s'il vous plait.
Dans le cadre de mon boulot, j'ai le code suivant :
Private Sub worksheet_change(ByVal Target As Excel.Range)
If Target.Column = 29 And Target <> '' Then
vréponse = MsgBox('LE TARIF DES CARTES A-T-IL CHANGE ???', vbYesNo + vbExclamation)
If vréponse = vbYes Then
Worksheets('Dépenses jour').Unprotect Password:='17121967'
NFT = InputBox('SAISISSEZ LE NOUVEAU TARIF', 'NFT')
Cells(177, 27).Value = NFT
Worksheets('Dépenses jour').Protect Password:='17121967'
End If
Else:
If Target.Column = 18 And Target <> '' Then
vréponse = MsgBox('L'ATTRIBUTION DES CAP Energie RELEVE-T-ELLE D'UNE DECISION CEP/CSE ?', vbYesNo)
If vréponse = vbYes Then
Target.Interior.ColorIndex = 6
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('b65536').End(xlUp)(2).Select
Else:
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 8
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('b65536').End(xlUp)(2).Select
End If
Else:
If ('av2') <= mai Then
Range('c65536').End(xlUp)(2).Select
Else:
If Target.Column = 2 And Target <> '' Then
vreponse = MsgBox('LA FAMILLE A-T-ELLE ATTEINT LE PLAFOND ?', vbYesNo)
If vreponse = vbYes Then
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 6
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('c65536').End(xlUp)(2).Select
Else:
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 2
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('C65536').End(xlUp)(2).Select
End If
End If
End If
End If
End If
End Sub
Tout marche à merveille sauf que, lorsque j'indique mon nouveau tarif de carte il ne s'affiche pas dans la cellule concernée ; qui peut me dire pourquoi ; je le remercie déjà à l'avance.
Qui pourrait m'aider s'il vous plait.
Dans le cadre de mon boulot, j'ai le code suivant :
Private Sub worksheet_change(ByVal Target As Excel.Range)
If Target.Column = 29 And Target <> '' Then
vréponse = MsgBox('LE TARIF DES CARTES A-T-IL CHANGE ???', vbYesNo + vbExclamation)
If vréponse = vbYes Then
Worksheets('Dépenses jour').Unprotect Password:='17121967'
NFT = InputBox('SAISISSEZ LE NOUVEAU TARIF', 'NFT')
Cells(177, 27).Value = NFT
Worksheets('Dépenses jour').Protect Password:='17121967'
End If
Else:
If Target.Column = 18 And Target <> '' Then
vréponse = MsgBox('L'ATTRIBUTION DES CAP Energie RELEVE-T-ELLE D'UNE DECISION CEP/CSE ?', vbYesNo)
If vréponse = vbYes Then
Target.Interior.ColorIndex = 6
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('b65536').End(xlUp)(2).Select
Else:
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 8
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('b65536').End(xlUp)(2).Select
End If
Else:
If ('av2') <= mai Then
Range('c65536').End(xlUp)(2).Select
Else:
If Target.Column = 2 And Target <> '' Then
vreponse = MsgBox('LA FAMILLE A-T-ELLE ATTEINT LE PLAFOND ?', vbYesNo)
If vreponse = vbYes Then
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 6
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('c65536').End(xlUp)(2).Select
Else:
Worksheets('Dépenses jour').Unprotect Password:='17121967'
Target.Interior.ColorIndex = 2
Worksheets('Dépenses jour').Protect Password:='17121967'
Range('C65536').End(xlUp)(2).Select
End If
End If
End If
End If
End If
End Sub
Tout marche à merveille sauf que, lorsque j'indique mon nouveau tarif de carte il ne s'affiche pas dans la cellule concernée ; qui peut me dire pourquoi ; je le remercie déjà à l'avance.