Populate userform from active cell row values

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Not sure if I’ve worded it correctly as I’m not sure what the procedure is called but will advise what I’m looking to do.

I have a worksheet of which the range of values are in column A to column J then down the page.

The user will double click a customers name of which is in column A & Userform1 will then be shown.

The userform will have Textboxes 1 to 10 where Textbox 1 will be the value on worksheet in column A then the following values on that same row will populate the form.
Textbox 2 = Column B
Textbox 3 = Column C
Textbox 4 = Column D
And so on until
Textbox 10 = Column J

Please can you assist thanks.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
The user will double click a customers name of which is in column A & Userform1 will then be shown.
To open the Userform1 you must have a code like the following in the events of your sheet where you want it to occur.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Target.Column = 1 Then
    Cancel = True
    UserForm1.Show
  End If
End Sub
Note Sheet Event:
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.​


----- --
Now put the following code inside your userform1:
VBA Code:
Private Sub UserForm_Activate()
  Dim i As Long
  For i = 1 To 10
    Controls("TextBox" & i).Value = Cells(ActiveCell.Row, i).Value
  Next
End Sub
Note:
if you already have an Activate event in userform1, you must replace it with the code above.​

I hope it helps you.
😇
 
Upvote 0
Solution
Thanks for the reply but i had to make a change so the above wasnt required in the end.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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