+ Reply to Thread
Results 1 to 15 of 15

Putting values from userform into specific location on spreadsheet.

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Putting values from userform into specific location on spreadsheet.

    I have two textbox's that the user enters values into. I want the first textbox value to be put into the last column of a specific spreadsheet. I want the second textbox value to be put into the cell immediately below that cell. Currently, I have:
    Please Login or Register  to view this content.
    Does anyone know what I am doing wrong?

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Putting values from userform into specific location on spreadsheet.

    cells(1,Lastcol).value = Textbox1.Text

    Try the above
    Elegant Simplicity............. Not Always

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    You are setting LastCol to the Address of the last column, it should be the Column of the last column.

    Try this, it should work but I'm not sure it'll actually do what you want.

    It'll put the value from TextBox1 in the 1st row of the last column and Textbox2's value in the next empty cell in the last column.

    Are you sure that's right?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    That did work, but I want it one more column over. I think I can manage that though. Thanks!

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    Do you mean you want customer in one column and part number in the next, or vice versa?

  6. #6
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    So right now it is changing the last column's first row and adding to the last cell. I want it to place the first textbox's value in a new column, after the last used one. Then have the second textbox's value directly below this.

  7. #7
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    Customer in one column, part number right below it

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    On which row?

  9. #9
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    The second one. The point of this userform is adding a new sutomer, so there will not be any existing parts underneath it.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    The 2nd row, always?

  11. #11
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    Yes. Second Row. Column that has the value of TextBox1, which is the new customer

  12. #12
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    For some reason no matter what adjustments I make, it continues to replace the last column (in the first row) that has a value with the textbox1.value. And then it adds textbox2.value to the first empty cell in that column. Any idea what is happening?

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    Guess what I'm going to ask you?

    Go on guess.

    Give up?

    Could you attach a sample workbook?

  14. #14
    Registered User
    Join Date
    05-08-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Putting values from userform into specific location on spreadsheet.

    Haha I sure can Norie!
    It is the NewCustomerUF and it is the CommanButton1_Click() Subprocedure

    Correct Document.xlsm

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Putting values from userform into specific location on spreadsheet.

    Why are you looking for the last column?

    Don't the customer and part# go in specific columns?

    Mind you, the only sheet I've found so far with Customer and Part # columns is Schedule, which doesn't appear in the code for NewCustomerUF.

+ 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