+ Reply to Thread
Results 1 to 9 of 9

Help to create Command Button with text boxes input

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013
    Posts
    9

    Help to create Command Button with text boxes input

    Hi guys!

    Hopefully you can help me with these problems. I'm having some trouble with my VBA project.

    Atm I have a excel spreadsheet with some labels (weeks and cities, x,y) and lots of data to represent sales in the particular week and city.

    I would like a combo box to list all the cities in the spreadsheet (they are all listed in the 1st coloum of the sheet).
    EDIT: I have added the combobox with .additem "" - a better solution is of course welcome!

    Furthermore i would like 2 textboxes to list additional data (where i can put in sales for the city i chose in the combo box) and a button which put in the data from the text box into the sheet in the right place!

    I have a button now that adds a new week to the spreadsheet so that part is covered!

    If you dont understand the questions please reply.

    Thanks in advance for your help!

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

    Re: Help to create Command Button with text boxes input

    Where do you want the controls to appear?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Help to create Command Button with text boxes input

    Quote Originally Posted by Norie View Post
    Where do you want the controls to appear?
    The controls are already made in a user form I have made!

    The only thing i need help with is the coding,

    Especially the part where the inputs in the text boxes will be inserted into the sheet.

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

    Re: Help to create Command Button with text boxes input

    I'm slightly confused, the thread title appears to be asking for help creating a command button.

    Perhaps you could attach a sample workbook so we can see what you actually have.

    To attach a workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Registered User
    Join Date
    06-19-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Help to create Command Button with text boxes input

    Here is a sample of the workbook I have,

    To understand the data:

    The first coloumn is CITIES (shortened city names) and the first row is WEEKNUMBER (4 is week number 4 etc)

    The first row in each city is the 'number of sales' and the next row is 'value of sales'. Each city has 2 rows.

    I have not yet been coding on the text boxes. The point is that you can insert a value in each textbox (number of sales in the left one, and value of sales in the right one). The command button in the button will then insert the values you have inputted into the right weeknumber and under the right City (the city you chose in the drop down menu).

    Does that clear it up a bit?
    Attached Files Attached Files
    Last edited by pasj; 06-19-2013 at 10:08 AM.

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

    Re: Help to create Command Button with text boxes input

    Try this for populating the combobox and putting the data on the worksheet.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-19-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Help to create Command Button with text boxes input

    Quote Originally Posted by Norie View Post
    Try this for populating the combobox and putting the data on the worksheet.
    THANKS Norie! Works like a charm at first but a problem accures.

    At first with a "blank" sample i add a new week. That works fine. I will then process sales numbers in for all the cities. That works fine aswell. But if i now add a new week it will still only change the values in the first added week (max col +1). The point is that I can add a new week and process in the numbers and it will do it for the week i just added, if you know what i mean!

    This is serious stuff though, I'm so much closer to the complete solution, i appreciate that!

  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: Help to create Command Button with text boxes input

    I can't reproduce that behaviour, but I think I know what you mean.

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

  9. #9
    Registered User
    Join Date
    06-19-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Help to create Command Button with text boxes input

    Quote Originally Posted by Norie View Post
    I can't reproduce that behaviour, but I think I know what you mean.

    Change this,
    Please Login or Register  to view this content.
    to this.
    Please Login or Register  to view this content.
    Works perfectly! You are the man!!

+ 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