+ Reply to Thread
Results 1 to 10 of 10

Move userform TextBox entries to cells on a sheet

  1. #1
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Move userform TextBox entries to cells on a sheet

    My question is simple. I have a CommandButton on a worksheet named 'Workup' that, when clicked, presents a userform with 15 textboxes (TextBox1 through TextBox15). I have CommandButton1 on the userform also. When I click CommandButton1, I want the value in the textboxes to be placed in cell A1 thru A15 on the sheet named 'Invoice". I think it's just a repeat of the same line of code for each of the 15 TextBoxes. Once the cells on the sheet 'Invoice' are populated, I want to print the sheet 'Invoice' on the default printer. Then, return to the original sheet named 'Workup' and close the userform. The reason I'm using a userform is because the CommandButton does several other things also. Thanks in advance.
    Last edited by rkjudy; 01-10-2011 at 10:58 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Move userform TextBox entries to cells on a sheet

    Without seeing your workbook and knowing where you are storing values, how about this sample. Place the code behind the form.

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 01-08-2011 at 11:22 PM.
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Move userform TextBox entries to cells on a sheet

    I'm new to VB and I didn't really understand the explanation so I've included an 'Example' sheet for you to see what I am trying to do. Thanks.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Move userform TextBox entries to cells on a sheet

    No problem, I don't see your workbook.

  5. #5
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Move userform TextBox entries to cells on a sheet

    Sorry for the oversight. Here's the workbook.
    Attached Files Attached Files

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Move userform TextBox entries to cells on a sheet

    Try this...
    Attached Files Attached Files

  7. #7
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Move userform TextBox entries to cells on a sheet

    I think I understand how I'm supposed to proceed, but my needs are just a little different than the example I gave you (my mistake). The CommandButton to show the UserForm is on the sheet 'Workup', NOT on the 'Invoice' sheet that will be filled in with data from the TextBoxes. Also, the cells that the data will go into (on the 'Invoice" sheet) are not uniform, but all over the sheet. I've included the Example workbook again that should better illustrated my exact needs. Thanks for your help.
    Attached Files Attached Files

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Move userform TextBox entries to cells on a sheet

    No problem.

    Replace the code with this new one.

    I update the first four textboxes and I'm sure you could fix the rest.

    The code uses the .Cells(1,1) notation which is R1C1. Starting in A1 click and hold while you drag the mouse to the location of the input cell. For the fist textbox I would start in A1 and drag to D3 and then look directly above colum A and it should read 3R x 4C.

    Therefore;

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Move userform TextBox entries to cells on a sheet

    Great! I get it. One thing, since I'm familiar with this method, is it possible to use the cell identifier (A1, A2, etc.) mehtod as opposed to the Rx,Cx method to identify the cell to place the TextBox data?

    ie. '.Cells(A1).Value = Me.txtBillTo.Value' as opposed to 'Cells(1, 1).Value = Me.txtBillTo.Value'

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Move userform TextBox entries to cells on a sheet

    That is not a problem

    Example
    Please Login or Register  to view this content.

+ 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