|
参与一下。。。- Sub ykcbf() '//2024.3.11
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim tm: tm = Timer
- Set d = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("地籍调查表")
- For Each sht In Sheets
- If sht.Name <> sh.Name Then sht.Delete
- Next
- p = ThisWorkbook.Path
- f = p & "\数据来源.xlsx"
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("Sheet1")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 9)
- wb.Close False
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then Set d(s) = CreateObject("Scripting.Dictionary")
- d(s)(i) = i
- Next
- For Each k In d.keys
- sh.Copy After:=Sheets(Sheets.Count)
- Set sht = Sheets(Sheets.Count)
- m = 5
- With sht
- .Name = k
- .DrawingObjects.Delete
- For Each kk In d(k).keys
- t = d(k)(kk)
- .Cells(m, 2) = arr(t, 2)
- .Cells(m + 1, 11) = arr(t, 9)
- xm = arr(t, 4)
- .Cells(m + 1, 21 + xm) = xm
- m = m + 2
- Next
- End With
- Next
- sh.Activate
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "共用时:" & Format(Timer - tm) & "秒!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|