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 CreaBp()
Dim Obj As OLEObject
Dim m As Integer, lst As String
' la liste déroulante
Set Obj = Sheets("Feuil2").OLEObjects.Add("Forms.combobox.1")
With Obj
.Left = 256
.Top = 9
.Width = 50
.Height = 15
End With
For m = 1 To 12
lst = lst & Format(DateValue("1/" & m & "/2016"), "mmmm") & ","
Next m
With Sheets("Feuil2").Range("A1").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, _
Formula1:=lst
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "Choix du mois"
.ErrorTitle = ""
.InputMessage = "Votre mois choisi"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub |
Partager