예를 들어 하나의 열에 이름이 채워져 있고 각 이름은 하나의 셀에 있습니다.하나의 열을 두 개의 열로 나누는 VBS
First_Name_1 Last_Name_1
First_Name_2 Last_Name_2
First_Name_3 Last_Name_4
성과 이름은 공백으로 구분됩니다. Visual Basic Script를 사용하여이 열을 두 개의 열로 나누어서 한 열에 First_Name이 있고 그 옆에 열에 Last_name이 있어야하는 방법은 무엇입니까?
이미이 코드를 사용해 보았지만 제대로 작동하지는 않습니다.
objExcel.ActiveSheet.Columns(4).Select
Do Until IsEmpty(ActiveCell)
'Search for position of space within the cell
SplitPoint = InStrRev(ActiveCell, " ", -1, vbTextCompare)
'Put the last name in the column next to the source column
ActiveCell.Offset(0, 1) = Trim(Left(ActiveCell, SplitPoint))
'Replace the source column with the first name
ActiveCell.Offset(0, 0) = Trim(Mid(ActiveCell, SplitPoint))
Loop
미리 감사드립니다.
당신이 범위의 다음 셀로 이동되지 않습니다