+ Reply to Thread
Results 1 to 12 of 12

Entering results by Data form - is it possible?

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Entering results by Data form - is it possible?

    Hi

    I have a spreadsheet of Football results in a table such that each team is listed in Column A and also Row 1 so that you can enter the scores as a season progresses. Results are calculated to produce a league table on another sheet.
    There are 24 Teams for a League, so Teams in the rows 2 to 25
    In the columns, I use 2 cells per result, one for Home score, one for away score, thus 48 columns.

    Is it possible to use some sort of Data Form to enter the results, maybe using drop down boxes to select the Home and Away team?

    Thanks for any thoughts on this

    Neil
    Last edited by neil40; 09-15-2012 at 07:24 AM. Reason: Solved

  2. #2
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Entering results by Data form - is it possible?

    I suggest posting a sample workbook. Would be helpful.
    Please click the * icon below if I have helped.

  3. #3
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Re: Entering results by Data form - is it possible?

    OK, here it is. Created in Excel 2010
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Entering results by Data form - is it possible?

    I'm having some trouble with this. Methods I would use don't seem to be working. Hopefully someone can help you out.

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Entering results by Data form - is it possible?

    Neil,

    Attached is a modified version of your provided workbook.
    In the 'Results' sheet cell A1 I have added a Form Control Button labelled "Enter Results", which has been assigned to the following macro (in Module1):
    Please Login or Register  to view this content.

    I created a userform named frm_EnterGameResults which contains 2 comboboxes (for selected the home and away teams), 2 textboxes (for entering their scores), and 2 buttons (Submit - to add an entry to the Results sheet, and Done - to close the userform). Here is the full code I used for the userform (commented as much as possible):
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Re: Entering results by Data form - is it possible?

    Thanks a lot for what you've done tigervator.

    However, I tried it out, and entered my first score and got a
    Microsoft Visual Basic pop up with
    Run-time error '91':
    Object variable or With block variable not set

    When I Debug, it highlights:
    lHomeCol = ws.Rows(1).Find(Me.cbo_HomeTeam.Text).Column 'Find which column the home team is on

    Neil

  7. #7
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Entering results by Data form - is it possible?

    Neil,

    Weird, I didn't get that error. Here, give this a try. Replace those Home/Away Row/Col lines with this instead:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Re: Entering results by Data form - is it possible?

    tigervator

    That now works thank you.
    One 'however' though, it put the result in the wrong place!
    Perhaps I forgot to explain that the Home team is in the rows and the away team in the columns!

    Well, on second glance, if I fill in for example Yeovil home team, Coventry away team, it actually filled the result in two places on the grid, namely with each being at home, and each being away

  9. #9
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Entering results by Data form - is it possible?

    I'm not sure I understand. If Brentford is the home team with 3 points and Carlisle United is the away team with 1 point, what should get populated where?

  10. #10
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Re: Entering results by Data form - is it possible?

    In that scenario, where Brentford are at home, scoring 3 goals (not points!!) and Carlisle are away scoring 1 goal the following cells would be populated.
    The 3 would go in H3 and the 1 in I3
    In the scenario I reported (Yeovil Home Vs Coventry Away) the following cells were populated - AV7/AW7 and also L25/M25 (The latter should be the correct population)

  11. #11
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Entering results by Data form - is it possible?

    In that case, change the btn_Submit_Click() code to the following:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    06-16-2010
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    152

    Re: Entering results by Data form - is it possible?

    tigeravatar (spelt it right this time!!)

    This is perfect. Thanks so much for the work you did on this.

    Have a great weekend
    Neil

+ 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