|
楼主 |
发表于 2023-2-26 19:11
|
显示全部楼层
- Sub test()
- Dim Arr, i, r, n
- Dim d As Object
- Set d = CreateObject("Scripting.Dictionary")
- Arr = Sheets("信息").Range("A1").CurrentRegion
- For i = 2 To UBound(Arr)
- d(Arr(i, 1)) = ""
- Next
- r = Sheets("信息").Range("a1048576").End(xlUp).Row
- For Each wb In d.keys
- Sheets("模板").Copy after:=Sheets(Sheets.Count)
- ActiveSheet.Name = wb
- ActiveSheet.Range("b12:k32").Clear
- r = 12
- For i = 2 To UBound(Arr)
- If ActiveSheet.Name = Arr(i, 1) Then
- [c4] = Arr(i, 1): [g4] = Arr(i, 2): [j4] = Arr(i, 3)
- [c5] = [i1]: [g5] = "病人类型": [j5] = "科别": [c6] = "医疗证号"
- [g6] = Arr(i, 13): [c7] = "临床诊断": [c8] = Arr(i, 5): [c9] = "备注": [g9] = Arr(i, 4)
- [i1] = FormatArr[i,13]&"yyyymmdd") & Format(处方序号, "000000")
- [i36] = Arr(i, 16): [b38] = Arr(i, 15): [g38] = Arr(i, 15)
- Cells(r + n, 2) = Arr(i, 8) & Arr(i, 9) & "*" & Arr(i, 12): Cells(r + n + 1, 2) = Arr(i, 11)
- n = Range("b32").End(xlUp).Row - 11
- End If
- 处方序号 = 处方序号 + 1
- Next
-
- n = 0
- Next
- End Sub
复制代码 |
|