php导入excel为txt,这样从Txt文件导入excel怎么处理?

Sub t()

Dim Str$, arr, i%, j%

j = 2: p = 18

Str = "/仪器数据.txt"

Application.DisplayAlerts = False

Open ThisWorkbook.Path & "" & Str For Input As #1

arr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)

Close #176

For i = 3 To 2755 Step 18

Range("a" & j) = Split(arr(i), ":")(1)

Range("b" & j) = Split(arr(i + 11), Chr(9))(1)

Range("c" & j) = Split(arr(i + 11), Chr(9))(2)

Range("d" & j) = Split(arr(i + 11), Chr(9))(3)

Range("e" & j) = Split(arr(i + 11), Chr(9))(4)

Range("f" & j) = Split(arr(i + 11), Chr(9))(5)

Range("g" & j) = Split(arr(i + 11), Chr(9))(6)

Range("h" & j) = Split(arr(i + 11), Chr(9))(7)

Range("i" & j) = Split(arr(i + 11), Chr(9))(8)

Range("j" & j) = Split(arr(i + 11), Chr(9))(9)

Range("k" & j) = Split(arr(i + 11), Chr(9))(10)

Range("l" & j) = Split(arr(i + 11), Chr(9))(11)

Range("m" & j) = Split(arr(i + 11), Chr(9))(12)

Range("n" & j) = Split(arr(i + 11), Chr(9))(13)

Range("k" & j) = Split(arr(i + 11), Chr(9))(14)

Range("o" & j) = Split(arr(i + 11), Chr(9))(15)

Range("p" & j) = Split(arr(i + 11), Chr(9))(16)

Range("q" & j) = Split(arr(i + 11), Chr(9))(17)

j = j + 1

Range("b" & j) = Split(arr(i + 12), Chr(9))(1)

Range("c" & j) = Split(arr(i + 12), Chr(9))(2)

Range("d" & j) = Split(arr(i + 12), Chr(9))(3)

Range("e" & j) = Split(arr(i + 12), Chr(9))(4)

Range("f" & j) = Split(arr(i + 12), Chr(9))(5)

Range("g" & j) = Split(arr(i + 12), Chr(9))(6)

Range("h" & j) = Split(arr(i + 12), Chr(9))(7)

Range("i" & j) = Split(arr(i + 12), Chr(9))(8)

Range("j" & j) = Split(arr(i + 12), Chr(9))(9)

Range("k" & j) = Split(arr(i + 12), Chr(9))(10)

Range("l" & j) = Split(arr(i + 12), Chr(9))(11)

Range("m" & j) = Split(arr(i + 12), Chr(9))(12)

Range("n" & j) = Split(arr(i + 12), Chr(9))(13)

Range("k" & j) = Split(arr(i + 12), Chr(9))(14)

Range("o" & j) = Split(arr(i + 12), Chr(9))(15)

Range("p" & j) = Split(arr(i + 12), Chr(9))(16)

Range("q" & j) = Split(arr(i + 12), Chr(9))(17)

j = j + 1

Next

For i = 2757 To 8293 Step 16

Range("a" & j) = Split(arr(i), ":")(1)

Range("b" & j) = Split(arr(i + 11), Chr(9))(1)

Range("c" & j) = Split(arr(i + 11), Chr(9))(2)

Range("d" & j) = Split(arr(i + 11), Chr(9))(3)

Range("e" & j) = Split(arr(i + 11), Chr(9))(4)

Range("f" & j) = Split(arr(i + 11), Chr(9))(5)

Range("g" & j) = Split(arr(i + 11), Chr(9))(6)

Range("h" & j) = Split(arr(i + 11), Chr(9))(7)

Range("i" & j) = Split(arr(i + 11), Chr(9))(8)

Range("j" & j) = Split(arr(i + 11), Chr(9))(9)

Range("k" & j) = Split(arr(i + 11), Chr(9))(10)

Range("l" & j) = Split(arr(i + 11), Chr(9))(11)

Range("m" & j) = Split(arr(i + 11), Chr(9))(12)

Range("n" & j) = Split(arr(i + 11), Chr(9))(13)

Range("k" & j) = Split(arr(i + 11), Chr(9))(14)

Range("o" & j) = Split(arr(i + 11), Chr(9))(15)

Range("p" & j) = Split(arr(i + 11), Chr(9))(16)

Range("q" & j) = Split(arr(i + 11), Chr(9))(17)

j = j + 1

Next

End Sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值