Results 1 to 3 of 3

Thread: Insert your algorithm here

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    19
    Hi all,
    Just want to get some different ideas as to how to write this algorithm. I wrote it already, but it seems pretty long and I would like it shorter if possible. Here goes. I have ten people on a team. They are split into two groups of 5 (0-4,5-9). Each person in the group alternates being on call for the week. The call schedule is as follows:

    MT***SS
    0123400
    5678955
    1234011
    6789566
    2340122
    7895677
    3401233
    8956788
    4012344
    9567899
    0123400
    .
    .
    .
    Thanks in advance for any ideas/help!!!

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up

    Hope my sample code can give you a better solution...

    Code:
    Option Explicit
    Private Const TEAM1 = "01234"
    Private Const TEAM2 = "56789"
    Private Const TEAM_MEMBER = 5
    Private Sub Command1_Click()
    Dim dCnt As Integer
    Debug.Print "MT***SS"
    For dCnt = 1 To 5
        Debug.Print Mid(TEAM1, dCnt, TEAM_MEMBER - (dCnt - 1)) & Left(TEAM1, dCnt - 1) & Mid(TEAM1, dCnt, 1) & Mid(TEAM1, dCnt, 1)
        Debug.Print Mid(TEAM2, dCnt, TEAM_MEMBER - (dCnt - 1)) & Left(TEAM2, dCnt - 1) & Mid(TEAM2, dCnt, 1) & Mid(TEAM2, dCnt, 1)
    Next
    End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    19

    Thumbs up

    Works great!! Thanks a lot.

    I had mine in two for loops, but yours is much more compact.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width