|
楼主 |
发表于 2022-1-2 22:23
|
显示全部楼层
Sub lqxs()
Dim Arr, myPath$, myName$, x$, y$
Dim aa, j%, Brr(1 To 500000, 1 To 2), n&
Application.ScreenUpdating = False
Sheet1.Activate
myPath = ThisWorkbook.Path & "\处理\"
myName = Dir(myPath & "*.xlsx")
Do While myName <> ""
With GetObject(myPath & myName)
n = n + 1
Brr(n, 1) = "PegeUrl": Brr(n, 2) = "房号表"
Arr = .Sheets(1).Range("A1").CurrentRegion
For i = 2 To UBound(Arr)
x = Arr(i, 4): y = Arr(i, 5)
If InStr(y, "},") Then
aa = Split(y, "}")
For j = 0 To UBound(aa) - 1
n = n + 1
Brr(n, 1) = x
If j = 0 Then Brr(n, 2) = aa(j) & "}" Else Brr(n, 2) = Mid(aa(j), 2) & "}"
Next
Else
n = n + 1
Brr(n, 1) = x: Brr(n, 2) = y
End If
Next
.Close False
End With
Cells.ClearContents
[a1].Resize(n, 2) = Brr
ActiveSheet.Copy
ActiveWorkbook.SaveAs thiswordbook.Path & "\结果\" & myName
ActiveWorkbook.Close
myName = Dir
Loop
Application.ScreenUpdating = True
End Sub
执行起来没有反应 |
|