|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(2, .Columns.Count).End(xlToLeft).Column
- arr = .Range("a1").Resize(r, c)
- End With
- With Worksheets("sheet2")
- .Cells.Clear
- r = 1
- For i = 3 To UBound(arr)
- With .Cells(r, 1)
- .Value = arr(i, 1) & "班课程表"
- With .Font
- .Name = "微软雅黑"
- .Size = 16
- End With
- .Resize(1, 9).Merge
- End With
- .Cells(r + 1, 3).Resize(1, 6) = Array("星期一", "星期二", "星期三", "星期四", "星期五", "星期六")
- With .Cells(r + 2, 1)
- .Value = "早读"
- .Resize(2, 1).Merge
- End With
- With .Cells(r + 4, 1)
- .Value = "上午"
- .Resize(5, 1).Merge
- End With
- With .Cells(r + 9, 1)
- .Value = "下午"
- .Resize(5, 1).Merge
- End With
- With .Cells(r + 14, 1)
- .Value = "晚练"
- .Resize(3, 1).Merge
- End With
- .Cells(r + 2, 2).Resize(2, 1) = [{1;2}]
- .Cells(r + 4, 2).Resize(10, 1) = [{1;2;3;4;5;6;7;8;9;10}]
- .Cells(r + 14, 2).Resize(3, 1) = [{1;2;3}]
- ReDim brr(1 To 10, 1 To 6)
- For j = 2 To UBound(arr, 2)
- If Len(arr(1, j)) <> 0 Then
- n = InStr("一二三四五六", Right(arr(1, j), 1))
- End If
- m = arr(2, j)
- brr(m, n) = arr(i, j)
- Next
- .Cells(r + 4, 3).Resize(UBound(brr), UBound(brr, 2)) = brr
- With .Cells(r + 1, 1).Resize(16, 8)
- .Borders.LineStyle = xlContinuous
- End With
- r = r + 18
- Next
- With .UsedRange
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|