+ Reply to Thread
Results 1 to 6 of 6

Help creating a Combo Macro to place data into another cell

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Help creating a Combo Macro to place data into another cell

    Hi folks,

    I'm new here, new to Excel 2010, I know what a macro is, even though I'm pretty useless at creating them.

    So far I've gotten through by looking at example code and modifying it. I've honestly got no idea how anyone got stuff done before Google!

    Anyhow...

    In Worksheet "Supply Calc" I've a combobox drop down list. The list pulls names from a "name range" called "Zone_Types" in a worksheet called "DATASHEET" which is a 2 column table with NAMES in column A, and a numeric value in column B.

    What I would like is when I select an item from the drop down ComboBox (named "TOL" by the way) for the numeric value associated with it (1 cell over) to appear in cell B25 on the "Supply Calc" worksheet.

    I know there may well be easier ways to do this, and if there are... by all means suggest them!

    This is my first post, I'm sorry if I've missed something, I've done some basic searches, but without knowing some of the terminology to use, it's been tough on this one.

    I also tend to ramble... so shutting up now. (thanks)
    Last edited by Darth269; 02-05-2012 at 07:11 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Help creating a Combo Macro to place data into another cell

    If it's an ActiveX combo box you've embedded on your sheet then you'll need to use the change event for the object. Something like this, perhaps:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Help creating a Combo Macro to place data into another cell

    Thanks Andrew-R, this seems great, but when I change the content of the dropdown box, i.e. make a selection, nothing appears in the specfied cell, I'm wondering...

    Are any of the items dependant certain heading fields? Such as line 8 where it mentions "lSEARCH_COL"?

    I've atached the sheet, hoping that this makes more sense...GM sheet.xlsm

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Help creating a Combo Macro to place data into another cell

    Sorry, the sTARGET_CELL value determines where the output goes.

    Changing that line to:

    Please Login or Register  to view this content.
    Should sort you out.

  5. #5
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Help creating a Combo Macro to place data into another cell

    Andrew-R... You are Awesome!

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Help creating a Combo Macro to place data into another cell

    By the way, unless you've got a good reason for using an ActiveX control you'd be far better off using the Data Validation setting on cell B3 to show the drop down list, then in cell B6 you could use the formula:

    =IF(B3="","",VLOOKUP(B3,DATASHEET!A:B,2,FALSE))

    And that would get rid of the need for VB altogether (plus embedded ActiveX controls have a reputation for being a bit flaky, so are probably best avoided).

+ 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