简体   繁体   中英

Excel : Input and Retrieve Data using Textbox

I have a listBox with different countries name, when a country is selected information related to this country will show up in a textbox. I did that using a simple VLOOKUP for a table containing the countries and comments columns.

=VLOOKUP(INDEX(countries,$C$10),countriestable,2,FALSE)

Now let's say I would like to add a Second TextBox, which will have a reverse action, user will input data/Comments in the textbox and this will be saved in the countriestable accordingly (As per country selected )

The problem is I could link the texbox2 to a cell and add the same formula as textbox1, but then when I input data, it will overwrite the linked-cell formula, then when I change countrie from the listbox, the values in Textbox2 logically will noo change ( static ).

How can I achieve a way where ( On same page ) I have a texbox to display data from the table ( Step1 is succesfull ) and a Texbox in which a user can write/input comment data ?

Thanks for any guidance, Regards

Excel version 2007

You need to decide if and when you want to transfer the comment of textbox2 into countriestable. As countriestable is a kind of "master table" I wouldn't recommend to go for formulas in it trying to pull comments across from the user sheet ... master tables should not contain formulas ... too elusive

Instead I would make the textbox2 field without any link to any specific Excel cell, but instead add a button which the user can press to transfer his/her comment into the countriestable. I also would maybe consider an additional column in countriestable for "user-comment" (as opposed to "generic-comment" which you retrieve upon entering/selecting the country). Lastly I could think of making 2 buttons instead of 1, with the functions "Add to user comment" / "Replace user comment"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM