Hello. I have a user activated Userform with a ListBox in Excel 2016. The user clicks an activation button, which launches the form, the user chooses an entry from the listbox (its source list is a named ranged on another worksheet) and the macro assigns the chosen entry to a cell on the main worksheet. This is all working fine. However, I'd like the default value that's highlighted on the listbox to be the value of a particular cell (unless that cell contains the word "Plan", in which case the listbox default value should be the first value in the list). Below are the macros that launch the UserForm/ListBox and that assign the ListBox value to a cell, respectively. I've searched quite a bit for a similar solution, but can't seem to find anything that works. Thank you for any insight, it's greatly appreciated.
Sub NewPlan1()
With UserFormPlan1
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
End Sub
Private Sub ListBoxPlan1_Click()
Sheets("Model").Range("A21").Value = ListBoxPlan1.Value
Unload Me
End Sub
Sub NewPlan1()
With UserFormPlan1
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
End Sub
Private Sub ListBoxPlan1_Click()
Sheets("Model").Range("A21").Value = ListBoxPlan1.Value
Unload Me
End Sub