|
楼主 |
发表于 2011-11-24 12:07
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 w_cun 于 2011-11-24 12:07 编辑
已经解决,代码如下,很经典!!!!!
Sub changformat()
Dim i As Integer, j As Integer, k As Integer, AAA As String, BBB As String, CCC As String
k = 1
CCC = ""
For i = 2 To Worksheets("原始表").Cells(65536, 1).End(xlUp).Row
AAA = Worksheets("原始表").Cells(i, 1)
BBB = Worksheets("原始表").Cells(i, 2)
For j = 1 To Len(BBB)
If Mid(BBB, j, 1) <> "," And j < Len(BBB) Then
CCC = CCC & Mid(BBB, j, 1)
ElseIf Mid(BBB, j, 1) <> "," Or j = Len(BBB) Then
CCC = CCC & Mid(BBB, j, 1)
k = k + 1
Worksheets("输出表").Cells(k, 1) = AAA
Worksheets("输出表").Cells(k, 2) = CCC
Else
k = k + 1
Worksheets("输出表").Cells(k, 1) = AAA
Worksheets("输出表").Cells(k, 2) = CCC
CCC = ""
End If
Next j
CCC = ""
Next i
End Sub
|
|