I have a 3 text fields called txt1.txt, txt2.txt, txt3.txt and a button called save that will save the contents into an excel spreadsheet and saving the spreadsheet called name.xls. Txt 1 info should be in column 1 and txt 2 in column 2 and so on. Can you guys help me out on the code?? Also I would like to create a picklist that is saved on column 4 is that a combo box?
It sounds pretty straight forward. User forms are good for this type of task. Usually the purpose for a data entry form is to control the user input for example ensure all fields are filled in or the right type of data is being entered. Is that your reason?
Also I would like to create a picklist that is saved on column 4 is that a combo box?
That is a combo box, or combo listbox. You can use from controls to place a combo box on a spreadsheet. You can also use them on a VB Userform. Would this list box be populated from previously entered values or contain a specified list of items?
How about you post your name.xls and your data entry spreadsheet with some sample data, and whatever logic you have built so far then it may be easier to give a suggestion that fits your schema.
For now, there will be no inital data. The spreadsheet will be updated depending on how what is being enetered from this program. The fields will be firstname.txt, lastname.txt, email.txt and a combo box that has values 1-3.
These values represent the type of student it is elementary, highschool, college.
These fields such have repectve columns on the spreadsheet when saved. I am new to VB is there anywayt you could help me out on the code for this? It saves as either a csv or .xls.
I am new to VB is there anywayt you could help me out on the code for this? It saves as either a csv or .xls.
Here is an example. There are 2 files. EnterStudentData.xls and Name.xls in the attached zip.
EnterStudentData.xls is the code file. There are named ranges on sheet1 for the combo list values and the name of your data workbook, where you want to save your data.
Name.xls is the data workbook. You should put a button on this workbook or toolbar button to activate the Macro 'EnterStudentData.xls!RunUserForm'
Typically you would Hide the code file 'Windows>Hide' then save the file hidden when prompted closing Excel App. This would allow the Userform to display without showing the underlying workbook and will hide your configuration settings.
You could enhance this by giving better data validation and providing a function to close the code file on closing the data and opening it with the data file. You will need to save your data file manually, this could also be incorporated into the data entry process in the code file.