4个回答
展开全部
要怎么储存?
应该用宏做个工具,很方便。
请将下面三个公式分别拷入三个单元格,我来帮你做:
=CHAR(81)&CHAR(81)&CHAR(47813)&CHAR(41914)&CHAR(50)&CHAR(52)&CHAR(48)&CHAR(53)&CHAR(56)&CHAR(50)&CHAR(56)&CHAR(48)&CHAR(57)&CHAR(56)
=CHAR(54218)&CHAR(53220)&CHAR(41914)&CHAR(69)&CHAR(88)&CHAR(67)&CHAR(69)&CHAR(76)&CHAR(65)&CHAR(85)&CHAR(84)&CHAR(79)&CHAR(64)&CHAR(49)&CHAR(50)&CHAR(54)&CHAR(46)&CHAR(67)&CHAR(79)&CHAR(77)
=CHAR(52436)&CHAR(45478)&CHAR(46570)&CHAR(41914)&CHAR(70)&CHAR(53)&CHAR(95)&CHAR(79)&CHAR(70)&CHAR(70)&CHAR(73)&CHAR(67)&CHAR(69)
应该用宏做个工具,很方便。
请将下面三个公式分别拷入三个单元格,我来帮你做:
=CHAR(81)&CHAR(81)&CHAR(47813)&CHAR(41914)&CHAR(50)&CHAR(52)&CHAR(48)&CHAR(53)&CHAR(56)&CHAR(50)&CHAR(56)&CHAR(48)&CHAR(57)&CHAR(56)
=CHAR(54218)&CHAR(53220)&CHAR(41914)&CHAR(69)&CHAR(88)&CHAR(67)&CHAR(69)&CHAR(76)&CHAR(65)&CHAR(85)&CHAR(84)&CHAR(79)&CHAR(64)&CHAR(49)&CHAR(50)&CHAR(54)&CHAR(46)&CHAR(67)&CHAR(79)&CHAR(77)
=CHAR(52436)&CHAR(45478)&CHAR(46570)&CHAR(41914)&CHAR(70)&CHAR(53)&CHAR(95)&CHAR(79)&CHAR(70)&CHAR(70)&CHAR(73)&CHAR(67)&CHAR(69)
追问
比如每个txt中文件都是一串数字201311150125, 201311160008……等等,都只有一个数据,存储到excel的单元格中,存储在第一列
追答
没问题的,发几个TXT样板过来,说明详细要求。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub test()
Dim reg As Object
Dim wjm As String
Set reg = CreateObject("vbscript.regexp")
With reg
.Global = True
.Pattern = "{""id"".*?}"
End With
wjm = Dir(ThisWorkbook.Path & "\*.txt")
m = 2
Do While wjm <> ""
txtm = ThisWorkbook.Path & "\" & wjm
Open txtm For Input As #1
Do While Not EOF(1)
Line Input #1, ss
If Left(Trim(ss), 4) = "list" Then
ss = Replace(ss, Chr(13), Chr(10) & Chr(13))
Set mathcs = reg.Execute(ss)
For i = 0 To mathcs.Count - 1
s = Replace(mathcs(i), """", "")
s = Replace(s, ":", ",")
xm = Split(s, ",")
For j = 1 To 3
Cells(m, j + 1) = xm(j * 2 - 1)
Next
For j = 4 To 5
Cells(m, j + 1) = xm(j * 2 + 1)
Next
Cells(m, 1) = wjm
m = m + 1
Next
Exit Do
End If
Loop
Close #1
wjm = Dir
Loop
End Sub
Dim reg As Object
Dim wjm As String
Set reg = CreateObject("vbscript.regexp")
With reg
.Global = True
.Pattern = "{""id"".*?}"
End With
wjm = Dir(ThisWorkbook.Path & "\*.txt")
m = 2
Do While wjm <> ""
txtm = ThisWorkbook.Path & "\" & wjm
Open txtm For Input As #1
Do While Not EOF(1)
Line Input #1, ss
If Left(Trim(ss), 4) = "list" Then
ss = Replace(ss, Chr(13), Chr(10) & Chr(13))
Set mathcs = reg.Execute(ss)
For i = 0 To mathcs.Count - 1
s = Replace(mathcs(i), """", "")
s = Replace(s, ":", ",")
xm = Split(s, ",")
For j = 1 To 3
Cells(m, j + 1) = xm(j * 2 - 1)
Next
For j = 4 To 5
Cells(m, j + 1) = xm(j * 2 + 1)
Next
Cells(m, 1) = wjm
m = m + 1
Next
Exit Do
End If
Loop
Close #1
wjm = Dir
Loop
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
换个思路。批量合并 txt 然后 导入excel 转换格式
追问
批量合并,导入excel没办法分列,没有分列的标识,全都是数字合并的,唯一分割点只是数字个数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你得说清楚 txt文件内容格式和excel 存储的格式啊。不然怎么知道你要怎么读取,怎么存储。
追问
比如每个txt中文件都是一串数字201311150125, 201311160008……等等,都只有一个数据,存储到excel的单元格中,存储在第一列
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |