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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

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