ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Display contents of a cell in a user form text box -- Excel 2003 VBA (https://www.excelbanter.com/excel-discussion-misc-queries/131277-display-contents-cell-user-form-text-box-excel-2003-vba.html)

hiskilini

Display contents of a cell in a user form text box -- Excel 2003 VBA
 
Hello,

I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!

Thanks,

John


ExcelBanter AI

Answer: Display contents of a cell in a user form text box -- Excel 2003 VBA
 
Hi John,

To display the value of cell F3 in a text box within a user form in Excel 2003 VBA, you can follow these steps:
  1. Open the VBA editor by pressing Alt + F11.
  2. Insert a new user form by clicking on Insert UserForm.
  3. Drag and drop a text box control onto the user form.
  4. Double-click on the user form to open the code window for the form.
  5. Add the following code to the UserForm_Initialize event:

    Formula:

    Private Sub UserForm_Initialize()
        
    TextBox1.Value Range("F3").Value
    End Sub 

  6. Save the user form and close the VBA editor.

Now, when you open the user form, the value of cell F3 will be displayed in the text box automatically. If the value of cell F3 changes, the text box will update automatically as well.

joel

Display contents of a cell in a user form text box -- Excel 2003 V
 
You should be able to set the value before the form is open.

Userform1.textbox1.text = "Mystring"

"hiskilini" wrote:

Hello,

I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!

Thanks,

John



hiskilini

Display contents of a cell in a user form text box -- Excel 2003 V
 
On Feb 19, 8:10 am, Joel wrote:
You should be able to set the value before the form is open.

Userform1.textbox1.text = "Mystring"



"hiskilini" wrote:
Hello,


I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!


Thanks,


John- Hide quoted text -


- Show quoted text -


I tried that, but it did not work--the text box is empty. This is
what I have:

Private Sub TextBox1a_Click()

Dim myString

Sheets("Data").Select
Range("F3").Select
myString = Range("F3")

UserForm2.TextBox1a.Text = myString

End Sub

Thanks.


Mike

Display contents of a cell in a user form text box -- Excel 2003 V
 
Does this work for you?

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("F3").Value
End Sub


"hiskilini" wrote:

Hello,

I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!

Thanks,

John



hiskilini

Display contents of a cell in a user form text box -- Excel 2003 V
 
On Feb 19, 8:21 am, Mike wrote:
Does this work for you?

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("F3").Value
End Sub



"hiskilini" wrote:
Hello,


I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!


Thanks,


John- Hide quoted text -


- Show quoted text -


Yes--that works perfectly. Thanks so much for your help!

John


Tom Ogilvy

Display contents of a cell in a user form text box -- Excel 20
 
You could also link the textbox to the cell using the controlsource property

In the textboxes property window, find the controlsource property
controlsource: Sheet1!F3

this may not be desirable if you allow the user to edit the textbox.

--
Regards,
Tom Ogilvy


"hiskilini" wrote:

On Feb 19, 8:21 am, Mike wrote:
Does this work for you?

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("F3").Value
End Sub



"hiskilini" wrote:
Hello,


I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!


Thanks,


John- Hide quoted text -


- Show quoted text -


Yes--that works perfectly. Thanks so much for your help!

John



mraheel

Quote:

Originally Posted by Tom Ogilvy (Post 452884)
You could also link the textbox to the cell using the controlsource property

In the textboxes property window, find the controlsource property
controlsource: Sheet1!F3

this may not be desirable if you allow the user to edit the textbox.

--
Regards,
Tom Ogilvy


"hiskilini" wrote:

On Feb 19, 8:21 am, Mike wrote:
Does this work for you?

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("F3").Value
End Sub



"hiskilini" wrote:
Hello,


I am trying to display the value of a static cell ("F3") in a text box
within a user form. The user should not have to take any action to
display this value--it is being used as a confirmation of a file
creation and provides instructions as to what the user should do
next. The value within the text box is the file name, which is being
written to cell "F3" of my worksheet. Any help anyone could provide
would be appreciated!


Thanks,


John- Hide quoted text -


- Show quoted text -


Yes--that works perfectly. Thanks so much for your help!

John


i try it and not work


All times are GMT +1. The time now is 01:20 AM.

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