Bonjour,
J'aimerais qu'à l'ouverture de mon classeur et après la sélection de ma feuille, certaines colonnes et lignes soient cachées. Or j'ai mis le code dans "ThisWorkbook" et cela ne fonctionne pas. Où le mettre pour que cela fonctionne???
Code d'appel du classeur
Et code pour cacher les cases dans le 2nd classeur
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 Sub final() Dim Feuille As Worksheet Workbooks.Open "C:\Documents and Settings\be8308\My documents\Perso\photosmod2.xls", , True Windows("photosmod2").Activate End Sub Private Sub CommandButton1_Click() Call final Sheets("1").Select For Each Feuille In Worksheets If (Feuille.Name <> "1") Then Feuille.Visible = False End If Next ActiveWorkbook.Saved = True 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
23
24
25
26
27
28
29
30
31 Sub Workbook_Open() Range("K1").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.EntireColumn.Hidden = True Range("A57").Select Range(Selection, Selection.End(xlDown)).Select Selection.EntireRow.Hidden = True Range("A1").Select Application.DisplayFullScreen = True End Sub Sub Workbook_BeforeClose(Cancel As Boolean) Range("J1").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.EntireColumn.Hidden = False Range("A56").Select Range(Selection, Selection.End(xlDown)).Select Selection.EntireRow.Hidden = False Application.DisplayFullScreen = False End Sub
Partager