+ Reply to Thread
Results 1 to 19 of 19

A code which is meant to multiply a cell by a combobox but doing other things?!

  1. #1
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    A code which is meant to multiply a cell by a combobox but doing other things?!

    Please Login or Register  to view this content.
    I have a piece of coding which is meant to multiply the cell in D29 by ComboBox1 to get a result in cell D30, but it will only do this when something is clicked on each time in ComboBox1. I want cell D30 to have a result each time D29 is altered, rather than having to click on the combobox list repeatedly!

    Thank you in advance....

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    You don't give much info. What module is the macro in? If you want the code to run when a cell is changed, it should be in that same sheet's Worksheet_SelectionChange( module; and you'll have to add code to ensure that it only runs on changes in D29.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    I am not sure what you mean by what module is the macro in?

    It only changes to cell G29 as nothing else is linked to cell G30, if that is what you mean?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Why don't you use a worksheet change event for your D29 value??

    Oops, I see that Ben already suggested almost the same thing.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    How would I do that?

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

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

    View Pic

  7. #7
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    I have the same problem with G30

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Hi rmp,

    Try:

    Please Login or Register  to view this content.
    Under the ComboBox1_Click code in the Sheet1 module.

  10. #10
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Hi that code is not working either

    Why did you put D9 in the code? isn't it supposed to be D29?

  11. #11
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    ProtonLeah it says Compile error: Block If without End If

  13. #13
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    protonLeah when I type your code then my value in D30 does not change at all!

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Yeah, change it to $D$29 but it's the same as ProtonLeah's code.

    BTW - Did your code work before??
    Last edited by xladept; 02-23-2014 at 05:06 PM.

  15. #15
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    it does not work! ProtonLeah's code blocks all my code from doing what its meant to

  16. #16
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    I have tried alot of codes but when only when the combobox value changes from the drop down list the value in D30 changes, but I want it to change when D29 changes as well as when the combobox value is changed

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Hi rmp,

    Try this:

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    02-19-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    no that does not work either...

    I just linked the combobox with another cell and put the IF formula into cell G30 and multiplied G29 by the other cell link, which was my last resort but its working!

    Thank you anyway

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: A code which is meant to multiply a cell by a combobox but doing other things?!

    Hi rmp,

    My program does work but I noticed an error in your CLEAR code - this is better:

    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)

Similar Threads

  1. If and Then Formula/Code to multiply with a Designated Cell
    By aaron.mendes in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-09-2013, 03:08 PM
  2. VBA ADODB Code...making things faster
    By rameez.bukhari in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2013, 05:26 AM
  3. Replies: 2
    Last Post: 02-23-2013, 03:58 PM
  4. the things to consider when your vba code needs to switch from .xls to .csv files
    By intothewild in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 06:27 PM
  5. [SOLVED] Multiply, Divide and Then Multiply in a cell
    By Brownie2576 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-22-2012, 08:57 PM

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