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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,623
Office Version
  1. 2007
Platform
  1. Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,130,445
Messages
5,642,194
Members
417,259
Latest member
gtacw

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