AnnieM
03-02-2017, 09:00 AM
Hi Experts,
I have a macro-enabled excel template with multiple combo boxes on a sheet.
My problem is that whenever I save and then reopen the file, the combo boxes are back to their original (unselected) content and I need them to re-open with the last selection.
My existing code is :
Private Sub Workbook_Open()
Dim arrString() As String
With Me
With Sheet1.cmbCompany
.AddItem "Select from List:"
.AddItem "2 : Company A"
.AddItem "3 : Company B"
.AddItem "8 : Company C"
.AddItem "7 : Company D"
.AddItem "1 : Company E"
.ListIndex = 0
End With
With Sheet1.cmbCustomer
.AddItem "Select from List or add Cust:"
.AddItem "Customer A"
.AddItem "Customer B"
.AddItem "Customer C"
.AddItem "Customer D"
.AddItem "Customer E"
.ListIndex = 0
End With
etc, etc.
I have tried to change this to a Workbook_New or Workbook_Initialize sub but then nothing works.
As you can probably tell I am a novice at this and so would appreciate your help enormously.
Thanks,
Anne
I have a macro-enabled excel template with multiple combo boxes on a sheet.
My problem is that whenever I save and then reopen the file, the combo boxes are back to their original (unselected) content and I need them to re-open with the last selection.
My existing code is :
Private Sub Workbook_Open()
Dim arrString() As String
With Me
With Sheet1.cmbCompany
.AddItem "Select from List:"
.AddItem "2 : Company A"
.AddItem "3 : Company B"
.AddItem "8 : Company C"
.AddItem "7 : Company D"
.AddItem "1 : Company E"
.ListIndex = 0
End With
With Sheet1.cmbCustomer
.AddItem "Select from List or add Cust:"
.AddItem "Customer A"
.AddItem "Customer B"
.AddItem "Customer C"
.AddItem "Customer D"
.AddItem "Customer E"
.ListIndex = 0
End With
etc, etc.
I have tried to change this to a Workbook_New or Workbook_Initialize sub but then nothing works.
As you can probably tell I am a novice at this and so would appreciate your help enormously.
Thanks,
Anne