+ Reply to Thread
Results 1 to 6 of 6

populate a cell with data from a comboBox.

  1. #1
    Registered User
    Join Date
    01-05-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    31

    populate a cell with data from a comboBox.

    hi all,

    This is a similar thread to one I created a couple of days ago.
    I now know that what I was asking in the other thread is impossible so I've decided to change my way of solving my problem.

    This time I have set up a user form designed to add the data in my comboBox to a worksheet in the same workbook I am using.
    With a comboBox called cboSubbies and defined a data range for the box called myRange. all is working well with the following code.
    The comboBox is populated with the data I am asking it to look for.

    Please Login or Register  to view this content.
    Now, I also have a button on my form.
    When I click the button I would like the selected data to be entered into a cell in a sheet called paperwork.

    It should be possible to add more than 1 entry by reloading the form and selecting another value.

    The target cells on my target sheet (paperwork) are from A6 to A15.

    The first time I add data from my form I want it to go to A6.
    The 2nd time A7 etc.

    I probably need to do something along the lines of the following...

    Select paperwork as the active worksheet.

    check to see if cell A6 is empty (="") if it is <> "" copy my data there. if it already has data in it move through the range till I find an empty cell.
    If all cells are full inform the user with a pop up box and don't copy my data across.

    This will be simple to some of you but to a novice like me it's a nightmare.
    I'm confident I know more or less what I NEED to do but I haven't got a clue HOW to do it.

    Any help would be appreciated.

    Paul.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: populate a cell with data from a comboBox.

    Let's abitrarily call this button on your form myButton. While in VB editor and you double click on myButton you should be able to add code to it. Add this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-05-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: populate a cell with data from a comboBox.

    Ok, I got it all to work but I need to find the end of my range of cells.....

    This is the code I have so far when I click the button to copy information to my target cells....


    Please Login or Register  to view this content.
    This adds my information to my target cells just fine until All the cells are full.
    It then gives me an error.

    I need to find the end of my range of target cells.

    Can anyone point me in the right direction please?

    Many thanks,

    Paul.

  4. #4
    Registered User
    Join Date
    01-05-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: populate a cell with data from a comboBox.

    Quote Originally Posted by stnkynts View Post
    Let's abitrarily call this button on your form myButton. While in VB editor and you double click on myButton you should be able to add code to it. Add this:

    Please Login or Register  to view this content.
    I must have been writing my post as you submitted yours

    Many thanks, I'll try it now.

  5. #5
    Registered User
    Join Date
    01-05-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: populate a cell with data from a comboBox.

    That works.

    I changed my code to the following.

    Please Login or Register  to view this content.
    Many thanks

  6. #6
    Registered User
    Join Date
    01-05-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: populate a cell with data from a comboBox.

    OOps, had to add a way to jump out of the loop otherwise all of my target cells get filled with the same data.

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

+ 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