View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default school timetable

Sub Fill()

RowNum = 1
ColNum = 1
RowCount = 1
Count = 0
Do While (Range("G" & RowCount) < "") Or _
(Count 0)

If Count = 0 Then
Count = Val(Range("G" & RowCount))
Char = Range("G" & RowCount)
RowCount = RowCount + 1
End If
'remove digits for shr
Do While IsNumeric(Left(Char, 1))
Char = Mid(Char, 2)
Loop
Cells(RowNum, ColNum) = Char
ColNum = ColNum + 1
If ColNum 5 Then
ColNum = 1
RowNum = RowNum + 1
End If
Count = Count - 1
Loop
End Sub


"kkwong27" wrote:

col A col B col C col D col E Col G
1 7M
2 4E
3
4


In col G i have 7hours math,4 hour English ect. How to auto generate by fill
Ro 1 col A, B, C, D, E, WITH M M M M M and the balance 2M into Row 2
col A, B, and E E E in row 2 col C, D, E and Row 3 col A with E etc
as below
col A col B col C col D col E Col G
1 M M M M M 7M
2 M M E E E 4E
3 E
4







kk