Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Keep text viewable

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What I am wanting to do is after a user enteres information in a text box, is the next time the user views the textbox the same information is in it. And the user will have the option of changing it if they like. This is what I have.

    Private Sub txtCust_AfterUpdate()
    Sheets("Customer").Range("C5").Value = TxtCust.Text
    End Sub

    Thx Dan

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Dan, there are at least 2 ways.

    1. Use: Me.Hide when you close the Userform, this way it will remain in memory and retain ALL control values.

    2. Use:

    TxtCust.Text =Sheets("Customer").Range("C5").Value

    In the Initialize Event of the UserForm.



  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Alot Dave, Just a beginer here.Have a good evening and thx for your time. Dan

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Wellington
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    You can try the following:

    Sub UserForm_Initialise()
    If Trim(Sheets("Customer").Range("C5").Value) <> "" Then
    TxtCust.Text = Sheets("Customer").Range("C5").Value
    End If
    End Sub

    'This sub is to add the value to your textbox before it shows up.

    Private Sub txtCust_AfterUpdate()
    Q = MsgBox("Change value", vbOKCancel, "Warning")
    If Q = vbYes Then
    Sheets("Customer").Range("C5").Value = TxtCust.Text
    End If
    End Sub

    Once the value in the textbox is changed, it will ask whether you want to change it or not.

    HTH

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Tiger. Looks good , Have a good evening. Dan

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •