ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variables in a Userform (https://www.excelbanter.com/excel-programming/428962-variables-userform.html)

Bishop

Variables in a Userform
 
Is there a way to use a variable in a userform text box? I have a Userform
I'm creating that has a text box. I want the text to say: "The following X
files will be consolidated for the month of Y." I will have variables X and
Y such that X will be equal to some integer and Y will be some string that
will be the name of a particular month. So say I have X = 4 and Y = March
then my text box should read: "The following 4 files will be consolidated for
the month of March."

How do I do this?

DMoney

Variables in a Userform
 
Private Sub CommandButton1_Click()
Dim x As Variant
Dim y As String
x = 4
y = "March"

TextBox1.Text = "The following " & x & " files will be consolidated for the
month of " & y & ""

End Sub


"Bishop" wrote:

Is there a way to use a variable in a userform text box? I have a Userform
I'm creating that has a text box. I want the text to say: "The following X
files will be consolidated for the month of Y." I will have variables X and
Y such that X will be equal to some integer and Y will be some string that
will be the name of a particular month. So say I have X = 4 and Y = March
then my text box should read: "The following 4 files will be consolidated for
the month of March."

How do I do this?



All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com