+ Reply to Thread
Results 1 to 8 of 8

Using VBA to add people to a table using form

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    39

    Using VBA to add people to a table using form

    Hey peeps, ive got a table on the bottom of my spreadsheet that has names of people in, first name in a clumn, last name in a coumn marks scored in a column and overall grade in a column. Ive created and coded a form which allows a user to enter the first name, last name and points but how do i get it to add it to the table, id really appreciate the help

    thanks very much

    ricki lambert

    ive attatched my worksheet in hope somone can have a look, as for the form that allows user entry, i havent got sa button coded to open it yet so you have to push alt + f11 to open the vba code thingy :p
    Attached Files Attached Files
    Last edited by VBA Noob; 01-13-2008 at 11:59 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Debug your code and you will see that your code has too many End subs (should be exit Sub) in this Procedure - Private Sub enterbtn_Click()

    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    39
    Please Login or Register  to view this content.
    ok so would the next bit after
    Please Login or Register  to view this content.
    be;

    Please Login or Register  to view this content.
    and in ur code u have it as firstnamelbl, wouldnt it be firtnametxtb????

    thanks

    sorry for being dumb lol
    Last edited by VBA Noob; 01-13-2008 at 12:54 PM.

  4. #4
    Registered User
    Join Date
    10-01-2007
    Posts
    39
    ok, so thanks to the code you have posted i have managed to get it to work, i just have two things i need to sort out

    q1) whenevr the detials get entered the are put correctly in to the columns, however, for the formual t owork correctly i nthe other columns the points section thats entered from the form needs to be in number format, and by right cicking the cell and changing to number doesnt work, i have to input the data i nthe form, then click the green thing that says convert this to number, then the rest fo the formulae in the othe column works

    q2) how do i add a button to the worksheet that will open the user form up, i realsie the code for a normally programemd button would be something like

    userform.show()

    thnanks peeps

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Change the Number Format with the code

    Please Login or Register  to view this content.
    Add a button from the Controls Toolbox then use
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-01-2007
    Posts
    39
    .Cells(R, 3).NumberFormat = "000"

    this still doesnt convert it????

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    using your examples & my last code, the formulas work in Columns D & E, and also the Mean. I gat no number stored as text error which i think you are referring to.

    You need to drag the formulas down in D & E, and amend the average formula.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This amendment will copy the formulas down for you

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1