Results 1 to 3 of 3

Thread: How to display content of cell in a text box Excel 2003 VBA

  1. #1
    Join Date
    Feb 2012
    Posts
    11

    How to display content of cell in a text box Excel 2003 VBA

    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.

  2. #2
    Join Date
    Aug 2011
    Posts
    460

    Re: How to display content of cell in a text box Excel 2003 VBA

    You should be able to set the value before the form is open. Userform1.textbox1.text = "Mystring". I tried that, but it did not work--the text box is empty. This is
    what I have:
    Code:
    Private Sub TextBox1a_Click()
    Dim myString
    Sheets("Data").Select
    Range("F3").Select
    myString = Range("F3")
    UserForm2.TextBox1a.Text = myString
    End Sub

  3. #3
    Join Date
    Jul 2011
    Posts
    434

    Re: How to display content of cell in a text box Excel 2003 VBA

    Does this work for you.
    Code:
    Private Sub UserForm_Initialize()
    TextBox1.Text = Worksheets("Sheet1").Range("F3").Value
    End Sub
    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.

Similar Threads

  1. Replies: 2
    Last Post: 03-02-2012, 07:28 PM
  2. Cell format errors appears in Excel 2003 but not in Excel 2000
    By @nki$achi in forum MS Office Support
    Replies: 1
    Last Post: 24-01-2012, 05:00 PM
  3. Cell text disappear in Excel
    By Sanju Baba in forum Windows Software
    Replies: 2
    Last Post: 07-01-2012, 08:05 PM
  4. Macro- Excel to copy cell content highlighted
    By Anwar in forum Windows Software
    Replies: 3
    Last Post: 06-03-2009, 02:04 PM
  5. Text not visible in cell only in Formula Bar (excel 2003)
    By NavinS in forum MS Office Support
    Replies: 1
    Last Post: 14-02-2008, 03:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,857,479.62600 seconds with 17 queries