Populate userform from active cell row values

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,215,084
Messages
6,123,024
Members
449,092
Latest member
ikke

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