+ Reply to Thread
Results 1 to 7 of 7

creating a house points scoring program

Hybrid View

  1. #1
    Registered User
    Join Date
    02-25-2013
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    4

    creating a house points scoring program

    Hi
    I wonder if anyone can give me some guidance. I need to create an excel program that will allow me to keep track of "house points" in a school. The idea is that there are 3 houses and as pupils earn points, I want staff to be able to access the program via the server and add points in a cumulative sense. All I want are three totals under the names of the houses and a space to add points - but I don't want the values added to be visible after they are entered. I.e. once you've entered 10 points, the cell then returns to a blank cell, but the total of points for the house increases. I'm not sure how to do this. If anyone could suggest a way or recommend a better suggestion, it would be most appreciated.

    I'm hoping to link the totals to a bar graph to make it easy for the pupils to see who is winning!
    Thanks very much!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: creating a house points scoring program

    One way is to use the Sheet Change event procedure.
    With the cell in which you enter the points named "points" and the cumulative points cell named "cumpoints" then
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("Points")) Is Nothing Then
            Range("CumPoints") = Range("Cumpoints") + Target
            Target = ""
        End If
    End Sub
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-25-2013
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: creating a house points scoring program

    How do I go about setting that up! Sorry bit of a novice with Excel?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: creating a house points scoring program

    Hi,
    First create the two named cells I mentioned. Then:


    1. Right click the sheet tab name and select 'View Code
    2. On the right in the left of the two drop down boxes select 'Worksheet'
    3. In the right hand drop down select the 'Change' option
    4, Add the code I gave you inside this code window.
    5.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: creating a house points scoring program

    At the risk of being told I am hijacking this thread (if anyone feels that strongly, I will start a new thread, referencing this 1)...

    Richard, I was trying to do this with msgbox's and am getting in a big mess. My concept was as follow...
    - start with 3 cells...1 for each house points
    - msgbox to ask for how many points to add
    - msgbox to ask which house gets them (Im sure this could be done with buttons, but Im taking baby steps)
    - based on which house is selected (1, 2, or 3), the points get added to what was already there

    I can get the points to add
    I can get the house
    I cannot get the points to go to the cell (probably because Im not telling it where to go?)
    Or, if I do get them to go where they need to, they replace what was there

    Sub Add_to_total()
        Dim HouseInput As Long, House1 As Long, House2 As Long, House3 As Long, Points As Long
    '    displ = MsgBox("add new house points?", vbYesNo)
    '    If displ <> vbYes Then Exit Sub
        Points = InputBox("Enter Points")
        HouseNumber = InputBox("Enter House Number (1, 2 or 3)")
        MsgBox Points
        MsgBox House1
        If HouseNumber = 1 Then House1 = House1 + Points
        MsgBox House1
        Range("a2").Select = House1
        If HouseNumber = 2 Then House2 = House2 + Points
        Range("B2").value = House2
        If HouseNumber = 3 Then House3 = House3 + Points
        Range("C2") = House3
    End Sub
    Remember, baby steps, I am not even up to learner level yet lol
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: creating a house points scoring program

    Hi Ford

    The main problem is that you'd Dimmed the variables as Local variables, i.e. the values only persist until the procedure's End Sub. You could either

    1. Declare the variables as Public variables above the Procedure. In which case they will persist when the procedure has finished and will still contain a value the next time the procedure is run.

    OR

    2. Use IF...Then in a block not as a single line. e.g.

    If housenumber = 1 Then 
    House1 = House1 + Points
    End If
    This means the If tests for the two house numbers that are not in play don't ever get actioned. With the single line IF...Then construct then the succeeding line for all three get actioned, i.e.
    Range("a2") = House1
    Another way is with the Select Case statement which I generally prefer, particularly if there are a lot of IF statements. i.e.

    Sub Add_To_Total()
    Dim Points As Long, housenumber As Long
        Points = InputBox("Enter Points")
        housenumber = InputBox("Enter House Number (1, 2 or 3)")
        Select Case housenumber
            Case Is = 1
            Range("A2") = Range("A2") + Points
            Case Is = 2
            Range("B2") = Range("B2") + Points
            Case Is = 3
            Range("C2") = Range("C2") + Points
    
        End Select
    End Sub
    or a slight mod to the Select Case idea

    Sub AddTotal()
    Dim Points As Long, housenumber As Long, r As Range
        Points = InputBox("Enter Points")
        housenumber = InputBox("Enter House Number (1, 2 or 3)")
        Select Case housenumber
            Case Is = 1
            Set r = Range("A2")
            Case Is = 2
            Set r = Range("B2")
            Case Is = 3
            Set r = Range("C2")
        End Select
        
        r = r + Points
    
    
    End Sub
    Last edited by Richard Buttrey; 09-29-2015 at 07:50 PM.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: creating a house points scoring program

    Thats for that, Richard. In the interests of KISS, I will stick with your 1st Select Case option. I knew there was a way to do that

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Points scoring system
    By Fessy82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-02-2015, 07:23 AM
  2. I need a scoring program that works in excel
    By cmimadmike in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-10-2014, 08:17 AM
  3. Creating a spreadsheet for an auction house
    By jckincaid in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-30-2014, 04:54 AM
  4. [SOLVED] Football (Soccer!) points scoring
    By Onceageordie in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2013, 10:22 AM
  5. [SOLVED] Help to automate ranking of tied teams in sports scoring program
    By alan_stephen75@ in forum Excel General
    Replies: 30
    Last Post: 06-11-2012, 02:27 PM
  6. Help Creating In House Reporting Excel Doc
    By Joey Bean in forum Excel General
    Replies: 2
    Last Post: 09-02-2008, 10:58 AM
  7. Assigning a points scoring system
    By zelus in forum Excel General
    Replies: 2
    Last Post: 05-17-2006, 10:07 PM

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