|
楼主 |
发表于 2012-4-14 22:20
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
TextToColumns 用法.......
Sub test()
Dim i%, r%, d, arr
Set d = CreateObject("scripting.dictionary")
Workbooks.Open ThisWorkbook.Path & "\检验单.xls"
arr = ActiveWorkbook.Worksheets(1).[a1].CurrentRegion
Workbooks("检验单.xls").Close
For i = 2 To UBound(arr)
d(arr(i, 1)) = arr(i, 2) & "|" & arr(i, 3)
Next i
For i = 2 To [b65536].End(3).Row
If d.exists(Cells(i, 2).Value) Then
Cells(i, 3) = d(Cells(i, 2).Value)
Cells(i, 3).TextToColumns OtherChar:="|"
End If
Next i
End Sub
|
|