+ Reply to Thread
Results 1 to 4 of 4

Random Team Macro needs updating

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    Oneonta NY
    MS-Off Ver
    Excel 2011
    Posts
    10

    Random Team Macro needs updating

    I have a macro that takes a list of names and brakes them into teams. Right now the list has 24 names and when I add names to the list I get a debug error that makes no sense. I did this once before months ago and forgot how to do it. I know the list has to be in column A at the top but cannot figure out where I increase the range so I can add or decrease the numbers of names or how many teams they form. The code is below. The Bold and red is what is highlighted with this error: Run time error -9. Out of range.

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 07-07-2013 at 08:36 PM. Reason: As per Forum Rule #3, please use code tags…Thanks.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Random Team Macro needs updating

    If there is not enough names to make all teams full, then the last team will only be partially filled.

    The error is because the last team in b is trying to add more names. All the names from a are used. At this point, n is > the Ubound(a)

    Try something like this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    09-28-2012
    Location
    Oneonta NY
    MS-Off Ver
    Excel 2011
    Posts
    10

    Re: Random Team Macro needs updating

    I posted the code where the error was and still got the same error. I even tried adding extra names onto the list so an equal amount of people would go to the teams but is still didn't work. Thoughts?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Random Team Macro needs updating

    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