If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > vb/excel question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-05, 20:52
inho78 inho78 is offline
Registered User
 
Join Date: Sep 2004
Posts: 113
vb/excel question

Hey guys,
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?
Reply With Quote
  #2 (permalink)  
Old 10-23-05, 21:35
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
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.
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 10-24-05, 13:00
inho78 inho78 is offline
Registered User
 
Join Date: Sep 2004
Posts: 113
Thanks so much bill.

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.
Thanks
Reply With Quote
  #4 (permalink)  
Old 10-24-05, 23:00
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
Quote:
Originally Posted by inho78
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.
Attached Files
File Type: zip EnterStudentData.zip (22.8 KB, 28 views)
__________________
~

Bill
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On