VBA - Textbox as caption

becklog

New Member
Joined
Dec 26, 2016
Messages
38
Hi,

I have a userform with several textboxes and a submit button.
My goal is to show a summary box of all entered data when the submit button is clicked.


Below is the code that I have but is not working. Thanks for the help!


Private Sub CommandButton1_Click()
Summary.Show
End Sub


then

---summary form---


Private Sub userform_initialize()
LawsonCon2.Caption = Lawsonbox.Value
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try:

Code:
Private Sub userform_initialize()
   LawsonCon2.[B][COLOR=#800080]Caption [/COLOR][/B]= [B][COLOR=#0000ff]Userform1[/COLOR][/B].Lawsonbox.Value 'change Userform1 by the name of your userform that contains the textbox
End Sub



LawsonCon2 is a textbox or a label?

If it is a label then it is correct to use .Caption, if it is a textbox then you must use .Value

If you do not want the editable textbox then:

Code:
Private Sub userform_initialize()
    LawsonCon2.Enabled = False
    'or
    LawsonCon2.Locked = True
    '
    LawsonCon2.Value = UserForm1.Lawsonbox.Value 
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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