|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 测试()
- Application.ScreenUpdating = False
- Columns("P:R").ClearContents
- ar = Range("A1").CurrentRegion.Rows.Count
- arr = Range("A1").CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- For i = 2 To ar
- If arr(i, 1) <> "" Then
- m = i
- End If
- If arr(i, 7) <> "" Then
- n = i
- End If
- d(arr(m, 1) & "-" & arr(n, 7) & "-" & arr(i, 9)) = ""
- Next
- k = d.keys
- Range("P:R").HorizontalAlignment = xlCenter
- [P10].Resize(1, 3) = Array("查询条件", "合同编号", "课程名称")
- [P11].Resize(d.Count, 1) = Application.Transpose(k)
- Set d = Nothing
- For j = 11 To Range("P11").End(4).Row
- br = Split(Range("P" & j), "-")
- Cells(j, 16) = br(0)
- Cells(j, 17) = br(2)
- Cells(j, 18) = br(1)
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|