school timetable

K

kkwong27

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
 
J

Joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top