Bonsoir à tous
j'ai ces 2 macros qui fonctionne bien si elles sont installées seule dans Worksheet_Change
ma question est:
comment les combiner
Merci
'==================================================
'<<<<<<< forcer majuscule dans la plage Nom>>>>>>>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim zz
Dim c As Range
Set zz = Intersect(Target, [Nom])
If zz Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each c In zz.Cells
c = UCase(c)
Next
Application.EnableEvents = True
'==================================================
'<<<<<<< forcer format telephone dans la colonne 3 >>>>>>>
Dim D_B As String
D_B = CStr(Target)
If Len(D_B) = 9 Then D_B = "0" & D_B
If Len(D_B) = 10 Then
Application.EnableEvents = False
D_B = Left(D_B, 2) & " " & Mid(D_B, 3, 2) & " " & Mid(D_B, 5, 2) & " " & Mid(D_B, 7, 2) & " " & Right(D_B, 2)
Target = D_B
Application.EnableEvents = True
End If
End Sub
j'ai ces 2 macros qui fonctionne bien si elles sont installées seule dans Worksheet_Change
ma question est:
comment les combiner
Merci
'==================================================
'<<<<<<< forcer majuscule dans la plage Nom>>>>>>>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim zz
Dim c As Range
Set zz = Intersect(Target, [Nom])
If zz Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each c In zz.Cells
c = UCase(c)
Next
Application.EnableEvents = True
'==================================================
'<<<<<<< forcer format telephone dans la colonne 3 >>>>>>>
Dim D_B As String
D_B = CStr(Target)
If Len(D_B) = 9 Then D_B = "0" & D_B
If Len(D_B) = 10 Then
Application.EnableEvents = False
D_B = Left(D_B, 2) & " " & Mid(D_B, 3, 2) & " " & Mid(D_B, 5, 2) & " " & Mid(D_B, 7, 2) & " " & Right(D_B, 2)
Target = D_B
Application.EnableEvents = True
End If
End Sub