Index Match Match formula in Excel VB


I want to have result of Index Match Match formula in Userform Text box without having to copy result from excel sheet cell to userform. I am very basic user of excel VB. I have recorded Macro and it works fine on the worksheet but when I apply the same codes to userform button it does not work. Gives error.

I have attached excel file for reference. Appreciate help from experts...

Thanks in advance




To make this as easy as possible, you can keep the formulas inside the worksheet and have the userform simply reference the worksheet.

Replace the current code for the CommandButton1_Click() with this:

Range("Model").Value = Model.Value
Range("Trvl").Value = HRS.Value
Price.Value = Range("F13").Value


Thanks for your reply. I have tried that and working fine. Actually I am looking for a code which will give me result directly on userform Textbox rather than getting results on worksheet cell and then transfering result value on Textbox. Is that possible ?
thanks once again for you help. 
joshi1957 Mar 7, '17 at 10:26 am
If you have all of your data on the worksheet anyway, just keep the example I used and hide the worksheet with the raw data. This is really your best bet for making a spreadsheet that is easy to use and troubleshoot in the future.

This way, no one will even see the spreadsheet, just your userform.

If you get some code now that you won't understand in 6 months, when you need to make a change, then the code now will simply make your life more difficult.
don (rep: 1969) Mar 8, '17 at 5:58 am
Thanks a lot for support !!
joshi1957 Mar 9, '17 at 8:55 am
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login