|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
给你改完了,你试看看,代码如下,有点忙,讲解的看看晚上有空时候再说
原帖由 lixjun 于 2011-4-13 11:33 发表
最近一直研究老师的脚本。麻烦老师给讲讲“散户大家庭”那个脚本里的这个“arr”是什么意思和使用规范。
ReDim arr(UBound(tmp) \ 38, 37)
For i = 1 To UBound(tmp)
arr((i - 1) \ 38, (i - 1) M ... - Sub test()
- Dim tmp() As String, i As Long, arr() As String, d As String, p As Integer, n As Long, xmlhttp As Object, JC As Worksheet, UserRange As Range, TMP1() As String
- Dim J As Long
-
- On Error Resume Next
- If Sheets("机构评级汇总") Is Nothing Then
- Set JC = Sheets.Add(AFTER:=Worksheets("起始页"))
- JC.Name = "机构评级汇总"
- Else
- Set JC = Sheets("机构评级汇总")
- Worksheets("机构评级汇总").Activate
- Cells.Select
- Selection.ClearContents
- End If
-
- [a1:k1] = Split("代码,评级日期,机构数,最新评级,上月机构数,上月评级,调整幅度,2010A,2011E,2012E,2013E", ",")
- FILE_PATH = ThisWorkbook.Path & "" & "机构评级汇总.xml"
-
- Application.ScreenUpdating = False
- Open FILE_PATH For Input As #1
- tmp() = Split(Split(Split(StrConv(InputB(LOF(1), 1), vbUnicode), "<lines>")(1), "</lines>")(0), "</line>")
- Close #1
-
- For i = 0 To UBound(tmp)
- TMP1() = Split(tmp(i), "</")
- For J = 0 To UBound(TMP1)
- arr() = Split(TMP1(J), ">")
- TMP1(J) = arr(UBound(arr))
- Erase arr
- Next
- n = [a65536].End(xlUp).Row + 1
- Cells(n, 1).Resize(1, UBound(TMP1) + 1) = TMP1
- Erase TMP1
- Next
-
- Erase tmp
- Set xmlhttp = Nothing
- [a:k].Columns.AutoFit
- Application.ScreenUpdating = True
- MsgBox "Ok"
- End Sub
复制代码 |
|