Bonjour,
J'ai un problème incompréhensible.
Mon but est de créer une entête à l'aide d'une macro.
Ma cellule (1,1) peut prendre la valeur 211101 ou 211102.

Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Sub test()
'Création de l'entete
 
Dim nom_enrob As String
Dim no_run As String
nom_enrob = Cells(1, 1).Value
    If nom_enrob = "211101" Then
        nom_enrob = "machine1"
    ElseIf nom_enrob = "211102" Then
        nome_enrob = "machine2"
    End If
 
no_run = ActiveSheet.Name
 
Application.PrintCommunication = False
ActiveSheet.PageSetup.LeftHeader = "Run°: " & no_run
ActiveSheet.PageSetup.CenterHeader = "&18" & nom_enrob
ActiveSheet.PageSetup.RightHeader = "&D&T&P/&N"
Application.PrintCommunication = True
End Sub
Le problème est lorsque je lance la macro pas à pas ça fonctionne mais quand je la lance en automatique ça bug!
Avez vous une idée du problème?