View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kevindmorgan[_5_] kevindmorgan[_5_] is offline
external usenet poster
 
Posts: 1
Default math wizard needed.


Very nice. I think I am going to go with this technique. I have notice
that in some cases it doesn't add up (try 3, 7, 11, or 15 students wit
4 periods) but I can modify it.

I am also going to "deal" the numbers to an array to speed things u
rather than do it on the sheet, but I owe the technique to you!

Thanks very much.

Kevin

Gary''s Student Wrote:
Hi Ronald:

Could a croupier technique be used? Deal out students two at a tim
until
they are completed distributed:

Sub dealer()

Application.ScreenUpdating = False
students = Cells(1, 1).Value
classes = Cells(2, 1).Value
pairs = Round(students / 2, 0)
check = students - pairs * 2

If check 0.5 Then
extra = 1
Else
extra = 0
End If

Columns("B:B").Select
Selection.Clear

j = 1
For i = 1 To pairs
Cells(j, 2).Value = Cells(j, 2).Value + 2
j = j + 1
If j classes Then
j = 1
End If
Next

Cells(j, 2).Value = Cells(j, 2).Value + extra
Application.ScreenUpdating = True
End Sub

--
Gary''s Student

TE


--
kevindmorga
-----------------------------------------------------------------------
kevindmorgan's Profile: http://www.excelforum.com/member.php...fo&userid=3223
View this thread: http://www.excelforum.com/showthread.php?threadid=53345