+ Reply to Thread
Results 1 to 7 of 7

TextBox - Read / Write

  1. #1
    Registered User
    Join Date
    06-07-2006
    Posts
    58

    TextBox - Read / Write

    Hi All,

    In a UserFrom, I have a TextBox link to cell "A1"
    When I open the UserFrom, I would like to see the actual value in "A1".
    Of course, I would like to be able to change the value from the UserForm !!
    Thanks

    RV

  2. #2
    Registered User
    Join Date
    07-28-2005
    Posts
    73
    Go to properties of the textbox by right clicking it and set the control source property value to a1

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Herve_Rob,

    Check the ControlSource property of the TextBox.

    Assuming the cell you want to link to is on Sheet1, it should like this...
    'Sheet1'!$A$1

    Excel will automatically update the TextBox when the UserForm is Activated, or the cell contents change. Also, if you type anything into the TextBox the cell will automatically reflect the change.

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    06-07-2006
    Posts
    58
    Hi,
    When I try to put something in ControlSource (under Data), a window pop-up with :

    "Could not set the ControlSource property. Invalid property values."

  5. #5
    Registered User
    Join Date
    01-13-2007
    Posts
    71
    i prefer a different way of doing the same thing...
    instead of calling this cell A1 name it as "sample", for instance.

    then write this code under the userform initialize (if you are not sure where to write it, double click the userform, it will show you "Private Sub userform_click()" then you switch it to initialize)

    Private Sub userform_initialize()

    textbox.controlsource = "sample"

    end sub

    it will do the same thing as writen above, but im not sure if the other method will let you link the textbox straight to a named cell, no matter in witch sheet you have the info.

    hope this help you out.

    MP

  6. #6
    Registered User
    Join Date
    06-07-2006
    Posts
    58
    Here is the file and still the same.
    Do not understand
    Attached Files Attached Files

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Herve_Rob,

    The main problem is the workbook you are trying to modify is a Shared and Protected. This automatically prevents you from changing the worksheet.

    Second, you named the worksheet "A1". The ControlSource property should be...

    TextBox1.ControlSource = "'A1'!$A$1"

    Until you create your own workbook and place the code in it. it won't work.

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1