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
| Private Sub UserForm_Initialize()
With ActiveSheet
.Protect UserinterfaceOnly:=True 'Password:="<le mot de passe>",
.EnableSelection = xlUnlockedCells
End With
End Sub
Private Sub CB_Ok_Click()
Dim lastCol As Integer
lastCol = Range("B1").End(xlToRight).Column
Application.ScreenUpdating = False
Range(Cells(1, 2), Cells(1, lastCol)).EntireColumn.Hidden = True
Columns(CB_LisFormation.ListIndex + 2).EntireColumn.Hidden = False
UF_Filtre.Hide
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Activate()
Dim lastCol As Integer
With ActiveSheet
Range(Cells(1, 2), Cells(1, Columns.Count)).EntireColumn.Hidden = False
lastCol = .Range("B1").End(xlToRight).Column
Dim vals As Variant
vals = Range(.Cells(1, 2), .Cells(1, lastCol))
CB_LisFormation.Clear
Dim vali As Integer
For vali = 1 To UBound(vals, 2)
Call CB_LisFormation.AddItem(vals(1, vali))
Next vali
CB_LisFormation.Text = vals(1, 1)
End With
End Sub |