Thread: Text To Columns
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
jetted jetted is offline
external usenet poster
 
Posts: 1
Default Text To Columns


Hi Debra

You could this macro

Sub separate_name_()
const_search = "/"
'assuming data is in column A
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To rowcount
Range("a" & i).Select
entirename = ActiveCell.Value
check_len = Len(entirename)
check_slash = InStr(entirename, const_search)
If check_slash 0 Then
left_name = Left(entirename, check_slash - 1)
right_name = Right(entirename, check_slash - 1)
ActiveCell = left_name
ActiveCell.Offset(0, 1).Select
ActiveCell = right_name
Else
Range("a" & i).Select
ActiveCell.ClearContents
Range("b" & i).Select
ActiveCell.Value = entirename
End If


Next i
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=559318