Hello David
You might like to consider simplifying this. As I intimated a loop would be better used to populate your text boxes
I alos see that every time you populate them you are calling the Function MyRange. Which means that you are calling it 43 times. Which is rather a waste of time and resources.
Just create an Excel dynamic range name called 'MyRange'
=OFFSET(Plan!$A$2,0,0,COUNTA(Plan!$A:$A),1)
Create a Public Variable in the VBA
In your Userform initialise event
Private Sub UserForm_Initialize()
Set myrange = Sheet1.Range("MyRange")
For Each cell In myrange
ComboBox1.AddItem cell
Next
End Sub
and now your ComboBox change event is
Private Sub ComboBox1_Change()
Dim x As Long
On Error GoTo 1
For x = 1 To 7
If x <> 7 Then
UserForm2.Controls("TextBox" & x) = myrange.Find(ComboBox1).Offset(0, x + 1)
Else
UserForm2.Controls("TextBox" & x) = Format(myrange.Find(ComboBox1).Offset(0, x + 1),"dd/mm/yyyy")
End If
Next x
TextBox43 = myrange.Find(ComboBox1).Offset(0, 1)
Label1 = ComboBox1
1 End Sub
Bookmarks