|
最多只会有两个成分吗?
Sub exchange_str()
irow = Range("a65536").End(3).Row
For i = 2 To irow
main_str = Split(Cells(i, 1), ":")(0)
obj_str = Split(Cells(i, 1), ":")(1)
If InStr(obj_str, " ") Then
first_obj_str = Split(obj_str, " ")(0)
last_obj_str = Split(obj_str, " ")(1)
first_obj1_str = Split(first_obj_str, "%")(0)
last_obj1_str = Split(first_obj_str, "%")(1)
first_obj2_str = Split(last_obj_str, "%")(0)
last_obj2_str = Split(last_obj_str, "%")(1)
Cells(i, 1) = main_str & ":" & last_obj1_str & first_obj1_str & "% " & last_obj2_str & first_obj2_str & "%"
Else
first_str = Split(obj_str, "%")(0)
last_str = Split(obj_str, "%")(1)
Cells(i, 1) = main_str & ":" & last_str & first_str & "%"
End If
Next
MsgBox "转换完成"
End Sub
|
|