Run Code To Fill Cells On Drop-down Change

  • Hi:


    I am busy with a project using VBA to populate a spreadsheet based upon the data entered into a particular cell. The problem that I am experiencing is that I populate the initial cell via a combo-box which I cannot exit unless I click elsewhere with my mouse.


    The code that I am using to populate the other cells is as follows (please don't laugh!!)




    I would really be grateful if someone could let me know how to either trigger the auto-fill function without needing to press Enter or perhaps let me know how to change the properties of the Combo-Box so that it is possible to Tab or Enter out of it. Or perhaps I should build something else and not use a combo-box at all?


    Please could you let me know, thank you.



    Kind regards,
    Mentor:)

  • Re: "auto-completion' Of Data Cells


    By "the auto-fill function without" I'll assume you mean your code as opposed to Excel's autofill method.


    What kind of combo-box is it? One from the Forms toolbar, or one from the Control Toolbox toolbar? Neither of which appears to trigger the worksheet change event when changed and linked to a cell on the sheet.


    Won't Data|Validation with a list not do? This does trigger the Worksheet change event.


    Otherwise, if it's a combobox from the Control Toolbox toolbar then it has its own change event into which you should place your code.


    p45cal

  • Re: Run Code To Fill Cells On Drop-down Change


    Hi P45cal:


    Thank you for your reply.


    I didn't think of a standard validation list - I'll try it thank you. I'll also try out the combobox change and see how that works, although I have to confess that I am not a great fan on the combobox at this point because the only way to deactivate it or move to the next cell or whatever in a worksheet is via mouse-click. Is that true or can you change that too?


    Have a great day!



    Kind regards,


    Mentor :smile:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!