Pre-populate a User Form based on current row

AlInVegas2

New Member
Joined
Jun 19, 2019
Messages
20
I'm trying to prepopulate a userform I created with the data from the Active Cell Row. After performing the userform.show, I am having difficulty populating the various text boxes with the values in the given row. It may have to do with the way I'm activating the form or something. Any suggestions?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try something like:
VBA Code:
Private Sub UserForm_Initialize()

Dim c As Range

Set c = Intersect(ActiveCell.EntireRow, Columns(1)) 'Column A

    With Me
        .TextBox1.Value = c.Value
        .TextBox2.Value = c.Offset(, 1).Value
        .TextBox3.Value = c.Offset(, 2).Value
    End With

End Sub
 
Upvote 0
Thanks for your response.

So the name of the form is EngUpdate. The Private Sub EngUpdate_Initialize() opens the form, but the first text field named EClient is blank when the form opens. The Active Row on Sheet 5 (Engagement Completion) has a client name. It's just not showing up on the form. Here's the code I wrote:

Private Sub EngUpdate_Initialize()

Dim c As Range
Set c = Intersect(ActiveCell.EntireRow, Columns(1))
With Me
.EClient.Value = c.Value
End With
End Sub

Any suggestions as to where I went wrong? My objective is to pull the key field values currently and subsequently update them with any changes I make when submitting.
 
Last edited:
Upvote 0
You should not change the name of the initialize event, it should always be
VBA Code:
Private Sub UserForm_Initialize()
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,849
Members
449,343
Latest member
DEWS2031

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top