Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Text To Columns
I am having a problem with "Text to Columns". I have a column which includes information which is separated by "/". However, the "/" is not included in every row of the column. i.e. 1 row in the column contains "ADMIN1/232322" and that's easy to make into two columns, however in row 2 I have "Whatever". This information goes into the left column where "ADMIN1" would be, but I need it to go into the right column where "232322" would be. Is there a way of me getting this information into the correct column? -- Debrap29 ------------------------------------------------------------------------ Debrap29's Profile: http://www.excelforum.com/member.php...o&userid=36127 View this thread: http://www.excelforum.com/showthread...hreadid=559318 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I unwrap text to columns? | Excel Discussion (Misc queries) | |||
Text to columns - one way street? | Excel Discussion (Misc queries) | |||
How do I convert from text to columns automatically on import? | Excel Discussion (Misc queries) | |||
comparing columns of text (cross-searching) | Excel Discussion (Misc queries) | |||
Text to columns | Excel Discussion (Misc queries) |