+ Reply to Thread
Results 1 to 2 of 2

Default value in Txtbox

  1. #1
    Registered User
    Join Date
    03-04-2005
    Posts
    12

    Default value in Txtbox

    I have a userform with multiple text boxes, dropdown lists, buttons etc. I want each text box to have a default value pulled from a certain cell until a user changes the value in the text box at which point the new value in the text box will change the value of the cell. I can already take the value of my textbox and input it into the cell, I just can't get a default value when I start.

    Private Sub cmdApply_Click()

    'copy the data to the database
    Worksheets("Cover").Range("B2").Value = Me.SysName.Value


    End Sub

  2. #2
    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 Baxter,

    Whenever you want to set an edit control's default value, you should do so during the UserForm_Activate event. Assign the string you want to the edit control's (TextBox or ComboBox) .Text property. This string will be overwritten when the user types in the edit portion of the control.

    Assign Default Value:

    Private Sub UserForm_Activate()

    ComboBox1.Text = "Vendors"
    TextBox1.Text = "Enter Address"
    ... etc

    End Sub

    _________________________________________________________________

    Hope this helps,
    Leith Ross
    Last edited by Leith Ross; 03-21-2005 at 09:16 PM.

+ 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