vba code for index match

  • Category Fruits FruitsPrice Vegetables VegPrice Dairy DairyPrice


    Fruits Apple $1.25 Tomato $0.99 Butter $3.45
    FruitsPrice Grape $2.00 Potato $1.45 Cheese $4.75
    Vegetables Pears $1.75 Onion $1.10 Milk $3.55
    VegPrice Cucumber $0.75
    Dairy
    DairyPrice


    I have the above table and 2 combo boxes; representing criteria 1) for "Category" (ROWS) and 2) for the "Items" under those categories (COLUMNS) and based on the 2 criteria in the ComboBoxes I would like to display the price in a TextBox using INDEX and MATCH if possible .
    My vba code for the "textbox1" is:




    The above code obviously does not work
    Can someone help me with the vba code. Thanks


    The rest of my code is:


  • Re: vba code for index match


    Hi akbarnikain,


    Not a good idea to use the source row in VBA
    made some changes to the userform syntax

  • Re: vba code for index match


    Thank you very much.


    I would appreciate your help for the "Add Category" (CommandButton1) and "Add Items" (CommandButton2) to be able to add "dynamically" items to the respective columns based on the "Category" in "Column-A"
    This would include when I ADD a new "Category/Item/Rate".
    Thanks

  • Re: vba code for index match


    Hi,
    The layout isn't helpful
    RoyUK has a freebie that has the correct layout for a spreadsheet
    http://www.excel-it.com/excel_databaseform.html


    the add item to a category is doable but you have use a named range for the Category


    if the data layout is like in RoyUK example the data is easily manipulated

  • Re: vba code for index match


    hello,
    with your layout and removing all rowsource references from combobox's

  • Re: vba code for index match


    removed a few bugs..try...

  • Re: vba code for index match


    Sorry to bother you...when Adding ("CommandButton2") a new Category ("combobox3"), new Item/Price ("TextBox3/4") it writes to the last empty row of the "whole table" rather than the first empty row for that new ("Category") column heading...also the same when adding new "items" to existing "categories". Can you help?
    Thanks

  • Re: vba code for index match


    no bother


    and



    you should add some edit buttons

  • Re: vba code for index match


    Not sure if you received my last email...I am sending it again.


    Sorry to bother you...when Adding ("CommandButton2") a new Category ("combobox3"), new Item/Price ("TextBox3/4") it writes to the last empty row of the "whole table" rather than the first empty row for that new ("Category") column heading...Can you help?
    Thanks

Participate now!

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