I have Private Sub combo boxes on 20 worksheets. I am trying to preload the months of the year in the combo boxes but I cant seem to make it work. What's wrong with my present code? It only adds the 12 months like, 120 times into the first combo box:
Sub WorkBook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ActiveSheet.ComboBox1.AddItem "January"
ActiveSheet.ComboBox1.AddItem "February"
ActiveSheet.ComboBox1.AddItem "March"
ActiveSheet.ComboBox1.AddItem "April"
ActiveSheet.ComboBox1.AddItem "May"
ActiveSheet.ComboBox1.AddItem "June"
ActiveSheet.ComboBox1.AddItem "July"
ActiveSheet.ComboBox1.AddItem "August"
ActiveSheet.ComboBox1.AddItem "September"
ActiveSheet.ComboBox1.AddItem "October"
ActiveSheet.ComboBox1.AddItem "November"
ActiveSheet.ComboBox1.AddItem "December"
Next ws
End Sub
ws.ComboBox1.AddItem "January"
etc. – Rik Sportelfor i=1 to 12:ws.combobox1.additem format(dateserial(2017,i,1),"mmmm"): next i
– Nathan_Sav