+ Reply to Thread
Results 1 to 2 of 2

If multiple comboboxes not used then stop populating cells at last combobox input

  1. #1
    Registered User
    Join Date
    08-05-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    If multiple comboboxes not used then stop populating cells at last combobox input

    Hi, I am new to this and this is probably very simple but I am trying to setup a userform with multiple combo boxes and text boxes. I have the form setup and it is working fine except for one thing.

    The form has a league combobox and if you pick the league it then goes to Date (input date from calendar). Once the league has been chosen you then go to home or away teams and it will give you a drop down of teams for that league. The scores are also combo boxes with 0-9. This all works fine but if I only want to add in say 4 match results for that week the form populates my sheet with 4 scores but 12 dates.

    e.g.

    28/10/2013 Team A 1 Team B 1
    28/10/2013 Team C 1 Team D 0
    28/10/2013 Team E 3 Team F 2
    28/10/2013 Team G 0 Team H 2
    28/10/2013
    28/10/2013
    28/10/2013
    28/10/2013
    28/10/2013
    28/10/2013
    28/10/2013
    28/10/2013

    My question is how can I add in say just 4 match results and only populate the spreadsheet with those 4 scores so it stops adding in the additional 8 lines with just the dates. Code for this form is below.

    Any help would be greatly appreciated.
    -----------------------------------------------------------------
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Fotis1991; 10-28-2013 at 09:41 AM. Reason: Pls use code tags around your codes as per forum rules.

  2. #2
    Registered User
    Join Date
    08-05-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: If multiple comboboxes not used then stop populating cells at last combobox input

    I changed the spreadsheet as a work around so that you have to input the date in for each match which worked nicely albeit a lot of extra code. code is below

    Private Sub CmdAdd_Click()
    Dim FirstBlankCell As Range
    Set FirstBlankCell = Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    FirstBlankCell.Activate

    ActiveCell.Offset(0, 0).Value = Format(Me.Date1.Value, "DD/MMM/YYYY") 'set col B ' - ADDED THIS FOR EACH MATCH changing Date1 to 2, 3, 4 etc.
    ActiveCell.Offset(0, 1).Value = Me.HomeTeam1.Text 'set col C
    ActiveCell.Offset(0, 2).Value = Me.HomeScore1.Text 'set col D
    ActiveCell.Offset(0, 3).Value = Me.AwayTeam1.Text 'set col E
    ActiveCell.Offset(0, 4).Value = Me.AwayScore1.Text 'set col F
    ActiveCell.Offset(1, 0).Value = Format(Me.Date2.Value, "DD/MMM/YYYY") 'set col B
    ActiveCell.Offset(1, 1).Value = Me.HomeTeam2.Text 'set col C
    ActiveCell.Offset(1, 2).Value = Me.HomeScore2.Text 'set col D
    ActiveCell.Offset(1, 3).Value = Me.AwayTeam2.Text 'set col E
    ActiveCell.Offset(1, 4).Value = Me.AwayScore2.Text 'set col F
    Last edited by JacobBlue; 10-31-2013 at 07:44 AM.

+ 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. [SOLVED] Print out combobox value to cell (for multiple comboboxes)
    By hemal89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2013, 08:56 AM
  2. Populating multiple forms from combobox choice and updating!
    By luargee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2012, 02:49 PM
  3. Populating comboboxes in a userform
    By metametrics in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2011, 09:34 AM
  4. Replies: 2
    Last Post: 09-24-2010, 08:35 AM
  5. Populating multiple combobox with same data
    By jberr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2010, 06:19 AM

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