VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create a system that lets the user type in a home team and an away team, then the score and updates

by Andrew Dolman (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 21st April 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create a system that lets the user type in a home team and an away team, then the score and updates the spreadsheet with games played, won,

Rate Create a system that lets the user type in a home team and an away team, then the score and updates



hometeam = InputBox("Enter Home team")
awayteam = InputBox("Enter Away team")
'start at the top of the teams list
    Range("B2").Select
    
    'repeatedly move down the list until the team is found or the bottom of the list is found
    While ActiveCell.Value <> team And ActiveCell.Value <> ""
        moveDown  'see module1
    Wend
    'if the team has been found then move across and increment the number of matches played
    If ActiveCell.Value = team Then
        moveRight  'see module1
        ActiveCell.Value = ActiveCell.Value + 1
    Else
        MsgBox "team not found", vbExclamation, "Team Not Found"
    End If
    'end of increase games played section
homescore = InputBox("please enter the score that the home team got")
awayscore = InputBox("please enter the score that the away team got")

Range("d2").Select
'starts at top of list
While ActiveCell.Value <> W And ActiveCell.Value <> ""
moveDown
Wend
If homescore > awayscore Then
ActiveCell.Value = ActiveCell.Value + 1
End If

If awayscore > homescore Then
ActiveCell.Value = ActiveCell.Value + 1
End If

End Sub


Download this snippet    Add to My Saved Code

Create a system that lets the user type in a home team and an away team, then the score and updates Comments

No comments have been posted about Create a system that lets the user type in a home team and an away team, then the score and updates. Why not be the first to post a comment about Create a system that lets the user type in a home team and an away team, then the score and updates.

Post your comment

Subject:
Message:
0/1000 characters