2 macros qui commande dans un fichier deux feuilles différentes
Sangler83
-
eriiic Messages postés 24603 Date d'inscription Statut Contributeur Dernière intervention -
eriiic Messages postés 24603 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
J'ai un fichier avec deux feuilles.
Au lieu de feuil 1 je l'ai nommée N
Au lieu de feuil 2 je l'ai nommée D
Comment faire pour que la 1ère en VBA travail seulement sur N et que la 2ème travaille sur D.
La 1ère et 2ème VBA sont de cette forme ci-dessous sauf quelle ne commande pas les mêmes colonnes.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
' MAJUSCULE
If Target.Count > 1 Or Target.Value = "" Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Columns("D")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("P")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("R")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("T")) Is Nothing Then
Target = UCase(Target)
End If
Application.EnableEvents = True ' facultatif
' Minuscule
If Target.Count > 1 Or Target.Value = "" Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Columns("G")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("M")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("N")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("Q")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("S")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("U")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
Application.EnableEvents = True
End Sub
Pouvez-vous m'aider ?
Je suis en EXCEL 2007
Cordialement
Merci
J'ai un fichier avec deux feuilles.
Au lieu de feuil 1 je l'ai nommée N
Au lieu de feuil 2 je l'ai nommée D
Comment faire pour que la 1ère en VBA travail seulement sur N et que la 2ème travaille sur D.
La 1ère et 2ème VBA sont de cette forme ci-dessous sauf quelle ne commande pas les mêmes colonnes.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
' MAJUSCULE
If Target.Count > 1 Or Target.Value = "" Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Columns("D")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("P")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("R")) Is Nothing Then
Target = UCase(Target)
End If
If Not Intersect(Target, Columns("T")) Is Nothing Then
Target = UCase(Target)
End If
Application.EnableEvents = True ' facultatif
' Minuscule
If Target.Count > 1 Or Target.Value = "" Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Columns("G")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("M")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("N")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("Q")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("S")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
If Not Intersect(Target, Columns("U")) Is Nothing Then
Target = WorksheetFunction.Proper(Target.Value)
End If
Application.EnableEvents = True
End Sub
Pouvez-vous m'aider ?
Je suis en EXCEL 2007
Cordialement
Merci
Configuration: Windows / Firefox 87.0
A voir également:
- 2 macros qui commande dans un fichier deux feuilles différentes
- Fichier bin - Guide
- Comment réduire la taille d'un fichier - Guide
- Comment ouvrir un fichier epub ? - Guide
- Invite de commande - Guide
- Fichier rar - Guide