Userform to enter values and shown in same userform in list

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
hi there

i have a Userform to enter values .......................

I need the same userform to show the entered values in list form ? How can i do this ????????

:(
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Andywiz

Board Regular
Joined
May 25, 2005
Messages
238
Hesham,

You could use a label on the useform to capture the values entered. Here is an example of what I mean...

On a userform there is:

1. TextBox1 - used to capture inputs from the user;
2. Label1 - used to display the inputs in a list;
3. CommandButton1 - used to 'submit' the entries to the list.

If you add the following code to CommandButton1, the entries will be recorded sequentially within the Label:

Code:
Private Sub CommandButton1_Click()

If Label1.Caption = "" Then

Label1.Caption = TextBox1.Value

Else:
Label1.Caption = Label1.Caption & vbCr
Label1.Caption = Label1.Caption & TextBox1.Value

End If

TextBox1.Value = ""

End Sub

Hope this helps you reach your aim, come back if you want help customising it to suit your userform.

Andywiz
 

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
Thank u very much (y)

It worked and got the idea...............

How can i sum the values entered when they appear under the Label ?

So i can show the summation in a TextBox ?
 

Andywiz

Board Regular
Joined
May 25, 2005
Messages
238
I guess you could try creating another textbox - say TextBox2 - to contain the total of the inputs going into the label. Then, if you were to try this new code, TextBox2 should show the running total as inputs to the label are added...

Code:
Private Sub CommandButton1_Click() 

If Label1.Caption = "" Then 

Label1.Caption = TextBox1.Value
TextBox2.Value = TextBox1.Value

Else: 
Label1.Caption = Label1.Caption & vbCr 
Label1.Caption = Label1.Caption & TextBox1.Value 
TextBox2.Value = TextBox2.Value + TextBox1.Value

End If 

TextBox1.Value = "" 

End Sub

I think you may run into difficulty if the entries to textbox1 are not numeric though - I haven't tested it I'm afraid.

Good luck with it,
Andywiz :eek:
 

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
Thank u 4 reply, but this line
Code:
TextBox2.Value = TextBox2.Value + TextBox1.Value
put the numeric values next to each other

i need to sum them insted ?
 

Andywiz

Board Regular
Joined
May 25, 2005
Messages
238
OK,

You can replace the line that's causing errors with:

Code:
TextBox2.Value = WorksheetFunction.Sum(TextBox2.Value, TextBox1.Value)

Hope it works for you now.
Cheers.
Andywiz
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,546
Messages
5,838,018
Members
430,526
Latest member
NiceGuyWithExcel2007

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
Top