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
| 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
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)
Application.ScreenUpdating = False
If ActiveSheet.ProtectContents = True Then
ActiveSheet.Unprotect Password:="1234"
If Application.CountA(Range(Site1L, SiteDL)) = 0 Then
' Masquer les Colonnes
OnOffShore.Select
Selection.EntireColumn.Hidden = True
InOutCongo.Select
Selection.EntireColumn.Hidden = True
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = True
Else
' Afficher les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = False
End If
Else
' Afficher les Colonnes
OnOffShore.Select
Selection.EntireColumn.Hidden = False
InOutCongo.Select
Selection.EntireColumn.Hidden = False
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = True
Else
' Afficher les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = False
End If
End If
ActiveSheet.Protect Password:="1234"
Application.ScreenUpdating = True
Else
If Application.CountA(Range(Site1L, SiteDL)) = 0 Then
' Masquer les Colonnes
OnOffShore.Select
Selection.EntireColumn.Hidden = True
InOutCongo.Select
Selection.EntireColumn.Hidden = True
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = True
Else
' Afficher les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = False
End If
Else
' Afficher les Colonnes
OnOffShore.Select
Selection.EntireColumn.Hidden = False
InOutCongo.Select
Selection.EntireColumn.Hidden = False
If HS55.Offset(-1, 0) = 0 Then
' Masquer les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = True
Else
' Afficher les Colonnes
HS55.Select
Selection.EntireColumn.Hidden = False
End If
End If
Application.ScreenUpdating = True
End If
Target.Offset(1, 0).Select |
Partager