Reputation: 425
I created an Excel form and expect the textbox in the form able to be auto-filled by the value in cell B2. I had tried but seems like my code in VBA didn't work for me. I attached my code below.
Private Sub UserForm_Click()
With UserForm1
.txtTextBox1.Value = Sheet7.Range("B10").Value
End With
End Sub
Upvotes: 0
Views: 209
Reputation: 36880
Use form Initialize
event like below.
Private Sub UserForm_Initialize()
Me.TextBox1 = Sheets("Sheet1").Range("B10") 'Change sheet1 to your sheet name.
End Sub
Upvotes: 1