Aidez-moi à lire le code suivant

dodo222

New Member
Joined
Dec 15, 2022
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Je veux que vous me lisiez le code suivant

Donc, pour l'apprendre et faire un programme comme celui-ci

Je veux que quelqu'un m'apprenne ce code

Merci

le code....

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Dim Nbr As Single
If ActiveCell.Row < 9 Then Exit Sub

If Cells(100, 1).Value = 1959 Then
If Target.Column = 4 And Val(Target.Text) > 20 Then
MsgBox ("superieure a 20")
Target.Value = 0
End If
If Cells(100, 1).Value = 1959 And Target.Column <> 4 Then Exit Sub
Target.Value = Val(Target.Value)
Else
Select Case Target.Column
Case 4 To 6
'MsgBox (Val(Target.Cells(Target.Row, Target.Column)))
If Val(Target.Text) > 20 Then
MsgBox ("superieure a 20")
Target.Value = 1
End If
Target.Value = Val(Target.Value)
Case 7
If Val(Cells(4, 9).Value) = 0 Then Nbr = 60 Else Nbr = Val(Val(Cells(4, 9).Value))
If Val(Target.Text) > Nbr Then
MsgBox ("superieure " & Cells(4, 9).Value)
Target.Value = 0
End If
Target.Value = Val(Target.Value)
End Select

End If
End Sub
Capture.PNG
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Event Macro - OzGrid Free Excel/VBA Help Forum
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top