XL 2019 Alerte "beep" après saisie et tabulation

Dravol

XLDnaute Junior
Bonjour à tous,

L'alerte "beep" de ma macro se déclenche lorsque je clique sur la cellule.

J'aimerai qu'elle se mette en route (après la saisie) après la tabulation ou lorsqu'on clique sur une autre cellule.
De plus, j'ai mis une valeur < à 35 alors que j'aimerai une formule =< "i10 x"*0.7 à la place (exemple si la valeur est 50 que le "beep" se déclenche à 50*0.7 soit < à 35
(je sais cela fait 2 questions sur un même post et si c'est gênant je créerai un autre post)

Merci pour vos retours^^

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim HCoché As Boolean, TV()
If Target.CountLarge = 1 Then
If Not Intersect([H18,J18], Target) Is Nothing Then
HCoché = IsEmpty([J18].Value)
[H18].Value = IIf(HCoché, Empty, ChrW(&H2713))
[J18].Value = IIf(HCoché, ChrW(&H2713), Empty)
ElseIf Not Intersect([Q24:S43,Q45:S48], Target) Is Nothing Then
TV = Array(Empty, Empty, Empty)
TV(Target.Column - 17) = ChrW(&H2713)
[Q:S].Rows(Target.Row).Value = TV
End If: End If
'If Target.Address = Range("d19").Address And Range("d19").Value < 35 Then
If Target.Address = Range("d19").MergeArea.Address And Range("d19").Value < 35 Then
Dim I
For I = 1 To 3 ' Loop 3 times.
Beep
'PlaySound ThisWorkbook.Path & "\0257", 0, 1
MsgBox "Attention valeur hors tolérance"
Next
End If

End Sub
 

Dravol

XLDnaute Junior
du coup j'ai trouvé tout seul.

Je ne savais pas qu'on pouvait arrêter une macro pour en démarrer une autre sur la même feuille avec 2 worskeet différents.

Private Sub Worksheet_selectionChange(ByVal Target As Range)
Dim HCoché As Boolean, TV()
If Target.CountLarge = 1 Then
If Not Intersect([H18,J18], Target) Is Nothing Then
HCoché = IsEmpty([J18].Value)
[H18].Value = IIf(HCoché, Empty, ChrW(&H2713))
[J18].Value = IIf(HCoché, ChrW(&H2713), Empty)
ElseIf Not Intersect([Q24:S43,Q45:S48], Target) Is Nothing Then
TV = Array(Empty, Empty, Empty)
TV(Target.Column - 17) = ChrW(&H2713)
[Q:S].Rows(Target.Row).Value = TV
End If: End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = Range("d19").Address And Range("d19").Value < 35 Then
'If Target.Address = Range("d19").MergeArea.Address And Range("d19").Value < 35 Then
Dim I
For I = 1 To 3 ' Loop 3 times.
Beep
'PlaySound ThisWorkbook.Path & "\0257", 0, 1
MsgBox "Attention valeur hors tolérance"
Next
End If

line:
Exit Sub
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
311 720
Messages
2 081 917
Membres
101 839
dernier inscrit
laurentEstrées