Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Code postal canadien

2 réponses
Avatar
Aiwa
On ma donner cette formule pour un code postal canadien, je veut enlever le message quand le code postal est inexact, que doit-je enlever, merc

Private Sub Worksheet_Change(ByVal Target As Range

Dim Rg As Rang
Set Rg = Intersect(Target, Range("E12,E30,L32")
Application.EnableEvents = Fals
If Not Rg Is Nothing The
For Each c In R
If c <> "" The
c.Value = UCase(Application.Trim(c)
If c.Value Like "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" Or
c.Value Like "[A-Z][0-9][A-Z][0-9][A-Z][0-9]" The
c.Value = Left(c, 3) & " " & Right(c, 3
Els
MsgBox "la saisie du code postal est inexacte
c.Interior.ColorIndex =
c.Font.ColorIndex =
End I
End I
Nex
End I
Application.EnableEvents = Tru
End Sub

2 réponses

Avatar
michdenis
Bonjour Aiwa,

Place une apostrophe devant la ligne de code, cette dernière ne s'exécutera plus. tu peux aussi simplement l'effacer.


Salutations!


"Aiwa" a écrit dans le message de
news:
On ma donner cette formule pour un code postal canadien, je veut enlever le message quand le code postal est inexact,
que doit-je enlever, merci

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Rg As Range
Set Rg = Intersect(Target, Range("E12,E30,L32"))
Application.EnableEvents = False
If Not Rg Is Nothing Then
For Each c In Rg
If c <> "" Then
c.Value = UCase(Application.Trim(c))
If c.Value Like "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" Or _
c.Value Like "[A-Z][0-9][A-Z][0-9][A-Z][0-9]" Then
c.Value = Left(c, 3) & " " & Right(c, 3)
Else
MsgBox "la saisie du code postal est inexacte"
c.Interior.ColorIndex = 3
c.Font.ColorIndex = 2
End If
End If
Next
End If
Application.EnableEvents = True
End Sub
Avatar
PRLLLLT
Tu dois supprimer la ligne contenant msgbox...