Q Re: userform txtbox population with row data from cell clicked to access userform.

OTOTO

Board Regular
Joined
Dec 23, 2013
Messages
209
In my worksheet I created code and a module so that when I double-click cells in column N a userform will open up. I need to pull information from the other columns in the same row that was used to access the form to populate text boxes in the userform. I am new to VBA and Excel Userforms so replies in some detail are more helpful. Thanks in advance for the help.
 
Thank You, but how are the controls on the form getting their intial values from the worksheet(s). I don't believe we've been privvy to that and I suspect that the problem may be there.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Thank You, but how are the controls on the form getting their intial values from the worksheet(s). I don't believe we've been privvy to that and I suspect that the problem may be there.


my text box which is being populated from the initial worksheet and which in turn populates the subsequent worksheet cell is titled txtRiskIDEdit. Here is the code which is used to pull the information I believe as you suggested.


Private Sub UserForm_Initialize()

Me.txtRiskIDEdit.MultiLine = True
Me.txtRiskIDEdit.Text = currSheet.Cells(currRow, "A") & vbLf & _
currSheet.Cells(currRow, "A")

End Sub
 
Upvote 0
OK - That was example code:

Code:
[COLOR=#333333]Me.txtRiskIDEdit.MultiLine = True[/COLOR]
[COLOR=#333333]Me.txtRiskIDEdit.Text = currSheet.Cells(currRow, "A") & vbLf & _[/COLOR]
[COLOR=#333333]currSheet.Cells(currRow, "A")[/COLOR]


If you don't want the textbox to be multi-line (i.e. stacking the values, then)
Code:
Me.txtRiskIDEdit.MultiLine = False


To get the cell value into the textbox just once then use
Code:
[COLOR=#333333]Me.txtRiskIDEdit.Text = currSheet.Cells(currRow, "A") [/COLOR][COLOR=#333333]
[/COLOR]


Then you'll need to clean up where the values in the cells that have been 'stacked' in the worksheet data [i.e. '6' linefeed '6']

 
Upvote 0
Your suggestion works. I turned indicated Multiline as False and removed the example code which didn't apply to end up with
Private Sub UserForm_Initialize()

Me.txtRiskIDEdit.MultiLine = False
Me.txtRiskIDEdit.Text = currSheet.Cells(currRow, "A")

End Sub

I'm not sure what you mean by the "Linefeed" cleanup. The problem currently is that the value is being identified as text although it is a number.



Then you'll need to clean up where the values in the cells that have been 'stacked' in the worksheet data [i.e. '6' linefeed '6']

[/QUOTE]
 
Upvote 0
Back in this post you stated
but when I submit it into the destination sheet I see 6 (Paragraph) 6, stacked on top of each other, but the cell identifies that its value is "6"?

Note: Your '
Paragraph' = My 'linefeed'

So the values are now stored in the worksheet and due to the Paragrah/linefeed, are interpreted as text.

When you select the cell and F2, you would see
6
6

re-enter the data as 6 and it will become numeric again, asuming the formatting is General or some Numeric-allowable format.
 
Upvote 0
Thanks for your help tweedle. I appreciate your input. This project is nearing completion thanks in part to your help
 
Upvote 0

Forum statistics

Threads
1,217,380
Messages
6,136,227
Members
450,000
Latest member
jgp19

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