当我下载包含不同类型信息的文件时,我遇到了一个问题,这些信息应存储在不同的单元格中,但所有信息都写在同一个单元格中。
例如 A:9 包含:
2016.03.16,"8982266507","QLGJG","AHGLG","OKK","IK","ODEADKIK","DK57200028982561607","485979,12","65164,94","485979,12","65164,94","485979,12","65164,94","","","","","","",
我想要一个宏来复制此字符串的特定部分,例如最后一部分"65164,94"
并粘贴到单元格A:10。
提前谢谢
答案 0 :(得分:1)
除了Seb的答案,您还可以使用分割功能。所以:
Sub splitting_string()
Dim arr1 As Variant, var1 As String
var1 = Range("A9")
arr1 = Split(var1, ",")
For i = 0 To UBound(arr1)
Cells(10 + i, 1) = arr1(i)
Next i
End Sub
这会将A9中的长字符串分成较小的字符串,每次有逗号时将它们分开,将它们放在下面的单元格中。