bonjour
je souhaite masquer une colonne avant d'imprimer et ensuite l'afficher.
pour cela jai fait les procedures suivante, mais exel imprime non pas apres la fin de la procedure "BEFOREPRINT", mais apres le "WORKSHEET"
dans le thisworbook :
dans la feuille:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Range("B2").Value = "CLOTURE DALLAS" Then Application.ScreenUpdating = False Columns("C:C").ColumnWidth = 0 Range("A1").Value = "1" Application.ScreenUpdating = True End If End Sub
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
21
22 Private Sub Worksheet_Activate() Application.ScreenUpdating = False Columns("C:C").ColumnWidth = 11.14 Application.ScreenUpdating = True End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim CellChange As Range Set CellChange = Range("A1") If Not Application.Intersect(CellChange, Range(Target.Address)) _ Is Nothing Then If CellChange = "1" Then Application.ScreenUpdating = False CellChange = "" Sheets("acceuil").Activate Sheets("DALLAS").Activate Application.ScreenUpdating = True End If End If End Sub
Partager