|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%, c%, j%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Worksheets("汇总")
- .AutoFilterMode = False
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(4, .Columns.Count).End(xlToLeft).Column
- ls = .Range("b3").MergeArea.Columns.Count
- arr = .Range("a3").Resize(r - 2, c)
- For i = 3 To UBound(arr)
- For j = 2 To UBound(arr, 2)
- If InStr(arr(i, j), vbLf) <> 0 Then
- xm = Split(arr(i, j), vbLf)
- If InStr(arr(i, j), "/") = 0 Then
- d(xm(1)) = Empty
- Else
- For k = 0 To UBound(xm)
- xx = Split(xm(k), "/")
- If UBound(xx) = 1 Then
- If xx(1) <> Empty Then
- d(xx(1)) = Empty
- End If
- End If
- Next
- End If
- End If
- Next
- Next
- For Each aa In Array("固排", "禁排", "课程总表")
- .Range("a5:a" & r).Copy Worksheets(aa).Range("a5")
- .Range("a3").Resize(2, c).Copy Worksheets(aa).Range("a3")
- Next
- For Each aa In Array("同时课", "连课")
- .Range("a5:a" & r).Copy Worksheets(aa).Range("a2")
- Next
- For Each aa In Array("教师节次限制", "教师指定节次不能同时有课")
- .Range("b4").Resize(1, ls).Copy Worksheets(aa).Range("b1")
- Worksheets(aa).Range("a2").Resize(d.Count, 1) = Application.Transpose(d.keys)
- Next
- End With
- Application.ScreenUpdating = True
- MsgBox "数据提取完毕!"
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|