Need to insert Textbox1,2,3 values inside of Textbox4 script which is dependent to combobox and having different scripts

  • Hi All,


    Thanks for your help,


    I'm new to vba but I tried to achieve most of the part but got struck with this approach.


    I have dependent combobox1 to textbox4, each selection which i do from combobox1 will give different script on Textbox4.

    So, I want Textbox1, Textbox2 & Textbox3 value which already displayed it's Value, so I want that value to add into this Textbox4 scripts.


    Exam: Textbox1 --> one, Textbox2 --> two, Textbox3 --> three


    Combobox1 list --> fruits, vegetables, location

    Textbox4: fruits --> Apple is good for your health, I have %Textbox1%, I will get them %Textbox2%, Total will be %Textbox3%.

    vegetables --> Vegetable buy %Textbox1% get %Textbox2%

    location --> Will you visit this %Textbox3% places


    So, Everytime I select anyone from combobox1 the script in Textbox4 will also change.. This Combobox1 & Textbox4 data is coming from Excel sheet where A column has Data for Combobox1 and B column has Data for Textbox4 from Sheet2.. And for other TextBox1,2,3 are getting data from column C, D & E from Sheet1.. Taking data from Sheet1 & Sheet2 and display then on sheet3 as a output with proper format which is already working..


    I can able to pull excel data on to this Userform, This combobox1 & Textbox4 dependent also working good but I couldn't able to use proper logic on how to get this Textbox1,2,& 3 value inside of Textbox4 script..


    And for this combobox & listbox together I have total upto 150 unique scripts and all those scripts will use TextBox1,2&3 for sure.


    So I wanted to use all those 150 Scripts like below directly from excel sheet B column and add values from those Textbox1,2,3.

    Apple is good for your health, I have %Textbox1%, I will get them %Textbox2%, Total will be %Textbox3%.

    Vegetable buy %Textbox1% get %Textbox2%

    Will you visit this %Textbox3% places


    Note: Even Textbox1,2 & 3 will change data and they are unique.


    Thanks

  • Hi royUK,


    Thank you for your reply.


    I modified original data with sample data but working with same logic.


    Please find my sheet attached and screenshot of the Userform.


    To access the UserForm please select Sheet3 and click "Add Data" button


    In my previous post I want to correct this line since i made some new changes "This Combobox1 & Textbox4 data is coming from Excel sheet where column A has Data for Combobox1 and B column has Data for Textbox4 from Sheet2.."


    Data I kept are in below columns of Sheet2.

    Combobox1 & Textbox4 data is coming from Column F & G


    Looking for your help..

  • Your code doesn't make any sense. You aren't using Select case correctly, it should be


    You don't have a TextBox10.


    I still can't tell exactly what you want

  • I have created screenshots and re-uploaded the sheet now..

    I removed some part of code which is not much important as of now and kept code which will use the userform..


    Along with other screenshots please look at "Script update on userform" image which I highlighted on what I except in final output in userfrom before I click on "Save my update" button.


    Still need to know anything else let me know.crm form.xlsm

  • Since it's confusing for you, only check below approach code then I'll ask for other in case If i couldn't able to find out. Ignore above what I wrote so far. since I couldn't able to explain better.. I need your help for below one only for now please.


    For below I have userform with 4 textboxs, 1 combobox & textbox dependent, one save button. I enter text in those 4 textbox's manually like customer name, amount, phone & email id.


    CategorySub-Category
    Mobile RechargeCustomer Name <Customer name> wanted to pay amount : <Amount> need to recharge for mobile number:<mobile number> and optional email id is: <email ID >
    Consult DoctorNeed to take appointment, Patient Name: <Customer Name> can reach him/her on phone number:<phone code> and email id:<email ID>
    loan Pending amount Dear customer: <customer name>, you having pending amount of <amount> which is registered on your mobile number:<phone number> further details you will get from bank.


    So, I have category & sub-category.. Category I kept in combobox & sub-category in Textbox. They're few other textbox which has customer name, amount, phone & email id. This category & sub-category both are for example I kept in Sheet2 in A & B column since they're many more than 100 and pulling directly into userform.


    Example: category is "Mobile recharge" sub-category is "Customer Name <Customer name> wanted to pay amount : <Amount> need to recharge for mobile number:<mobile number> and optional email id is: <email ID >". there are different script like this as shown in above table format.


    I want to display other Textbox's (Customer name, amount, phone & email id) into this sub-category script.. how to do it..?


    I need your code only to modify sub-category script with other textbox's is all I wanted.. On sub-category textbox I want to add other textbox's values like below:

    Customer Name(Textbox1) --> Jhon

    Amount(Textbox2) --> 150

    Phone(Textbox3) --> 123456789

    Email ID(Textbox4)--> [email protected]


    I want to see in sub-category textbox modified like below before I save to sheet.

    "Customer Name <Jhon> wanted to pay amount : <150> need to recharge for mobile number:<123456789> and optional email id is: <[email protected]>"


    If I select another category & sub-category then also values of other textbox's need to modify accordingly with sub-category.


    I need code for above approach for now..