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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim Site As Range
Dim Site1L As Range
Dim SiteDL As Range
Dim OnOffShore As Range
Dim InOutCongo As Range
Dim HS55 As Range
Application.ScreenUpdating = False
If ActiveSheet.ProtectContents = True Then
ActiveSheet.Unprotect Password:="1234"
Set Site = Cells(26, 1).EntireRow.Find(What:="Site", LookAt:=xlWhole)
Set Site1L = Site.Offset(1, 0)
Set SiteDL = Site.Offset(48, 0)
Set OnOffShore = Cells(26, 1).EntireRow.Find(What:="On / OffShore", LookAt:=xlWhole)
Set InOutCongo = Cells(26, 1).EntireRow.Find(What:="In / Out of Congo", LookAt:=xlWhole)
Set HS55 = Cells(26, 1).EntireRow.Find(What:="55%", LookAt:=xlWhole)
If Not Site Is Nothing Then
If Application.CountA(Range(Site1L, SiteDL)) = 0 Then
' Masquer les Colonnes
If Not OnOffShore Is Nothing Then
OnOffShore.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne 'In / Out of Congo' introuvable")
End If
If Not OnOffShore Is Nothing Then
InOutCongo.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne 'On / OffShore' introuvable")
End If
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne '55%' introuvable")
End If
Else
' Afficher les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne '55%' introuvable")
End If
End If
Else
' Afficher les Colonnes
If Not OnOffShore Is Nothing Then
OnOffShore.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne 'In / Out of Congo' introuvable")
End If
If Not OnOffShore Is Nothing Then
InOutCongo.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne 'On / OffShore' introuvable")
End If
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne '55%' introuvable")
End If
Else
' Afficher les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne '55%' introuvable")
End If
End If
End If
Else
MsgBox ("Colonne 'Site' introuvable")
End If
ActiveSheet.Protect Password:="1234"
Application.ScreenUpdating = True
Else
Set Site = Cells(26, 1).EntireRow.Find(What:="Site", LookAt:=xlWhole)
Set Site1L = Site.Offset(1, 0)
Set SiteDL = Site.Offset(48, 0)
Set OnOffShore = Cells(26, 1).EntireRow.Find(What:="On / OffShore", LookAt:=xlWhole)
Set InOutCongo = Cells(26, 1).EntireRow.Find(What:="In / Out of Congo", LookAt:=xlWhole)
Set HS55 = Cells(26, 1).EntireRow.Find(What:="55%", LookAt:=xlWhole)
If Not Site Is Nothing Then
If Application.CountA(Range(Site1L, SiteDL)) = 0 Then
' Masquer les Colonnes
If Not OnOffShore Is Nothing Then
OnOffShore.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne 'In / Out of Congo' introuvable")
End If
If Not OnOffShore Is Nothing Then
InOutCongo.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne 'On / OffShore' introuvable")
End If
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne '55%' introuvable")
End If
Else
' Afficher les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne '55%' introuvable")
End If
End If
Else
' Afficher les Colonnes
If Not OnOffShore Is Nothing Then
OnOffShore.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne 'In / Out of Congo' introuvable")
End If
If Not OnOffShore Is Nothing Then
InOutCongo.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne 'On / OffShore' introuvable")
End If
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = True
Else
MsgBox ("Colonne '55%' introuvable")
End If
Else
' Afficher les Colonnes
If Not HS55 Is Nothing Then
HS55.Select
Selection.EntireColumn.Hidden = False
Else
MsgBox ("Colonne '55%' introuvable")
End If
End If
End If
Else
MsgBox ("Colonne 'Site' introuvable")
End If
Application.ScreenUpdating = True
End If
Target.Offset(1, 0).Select |