+ Reply to Thread
Results 1 to 15 of 15

Using userform to input data

Hybrid View

  1. #1
    Registered User
    Join Date
    05-03-2008
    Posts
    23

    Using userform to input data

    I'm trying to create and use a userform to input data into specific cells in a sheet. For instance, if I create the userform with 4 text boxes and I want the user to input numbers into those text boxes that then fill in a hidden sheet.

    "Textbox A" = cell A2 on sheet 1
    "Textbox B" = cell B2 on sheet 1
    etc.

    I actually have 8 boxes for the user to input numbers (some are percentages, some are dollar amounts) and then an update button.

    How do I do this?

  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,259
    Hello SoCalRizzy,

    The basic code is to load a TextBox with a cell's contents is this...
      TextBox1.Value = Worksheets("Sheet1").Range("A2").Text
    Since the TextBox can only accept a string value the Text property of the cell is used instead of the Value property. Reverse the code to copy the value of the TextBox into a cell.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    05-03-2008
    Posts
    23
    If someone could take a look at this to see what I'm trying to do. If you open up VBE you can see the userform I'm trying to create. There are 6 text boxes that need to be filled out and then an "Update" button to update the corresponding cells with what was entered. I'm VERY new to VBA so I have no idea how to do this. Any help would be greatly appreciated.
    Attached Files Attached Files

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

    Which cells will the TextBox data be updating? Column "B"?

    Sincerely,
    Leith Ross

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

    I added code to the UserForm to copy the data from the TextBoxes to the worksheet cells in column "B". Not sure if I got all the percentages and dollar amounts in the right place, but it is a start. The data is transfered after the pressing enter, instead of using the update button. This want to change this, let me know.

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-03-2008
    Posts
    23
    This is wonderful so far! I was hoping I would be able to figure it out now by looking at the code, but it's still somewhat confusing. How hard is it to have the "Cancel" and "Update" buttons work?

+ 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