Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
splitting information into 2 cells
Is there a way to split information that is in 1 cell on sheet 1 into 2 cells
on sheet 2 Sheet 1 cell(K2) might have something like this 774-5992 / 647-4364 or 321-774-5992 / 647-4364 I want it to be copied to sheet 2 cells (A7) & (B7) 774-5992 would be in A7, 647-4364 would be in B7. If (K2 only has one set of #s (774-5992) then nothing happens. The cells with 2 sets of #s always has / as a divider. I would like to beable to insert the code to make this happen into a recorded macro. that copies other cell information from sheet 1 into sheet 2. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
splitting information into 2 cells
Hu Kelly,
Try this function: Public Function SplitStr(StrToSplit As String, SplitChar As String, PartNo As Integer) As String SplitStr = IIf(PartNo = 1, Left(StrToSplit, InStr(StrToSplit, SplitChar) - 1), _ Mid(StrToSplit, InStr(StrToSplit, SplitChar) + 1)) End Function Use it like this: Range("A7") = SplitStr(Range("K2"), "/", 1) Range("B7") = SplitStr(Range("K2"), "/", 2) Regards, Stefi €˛Kelly********€¯ ezt Ć*rta: Is there a way to split information that is in 1 cell on sheet 1 into 2 cells on sheet 2 Sheet 1 cell(K2) might have something like this 774-5992 / 647-4364 or 321-774-5992 / 647-4364 I want it to be copied to sheet 2 cells (A7) & (B7) 774-5992 would be in A7, 647-4364 would be in B7. If (K2 only has one set of #s (774-5992) then nothing happens. The cells with 2 sets of #s always has / as a divider. I would like to beable to insert the code to make this happen into a recorded macro. that copies other cell information from sheet 1 into sheet 2. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
splitting information into 2 cells
Just use DataText To Columns and use / as a delimiter.
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "Kelly********" wrote in message ... Is there a way to split information that is in 1 cell on sheet 1 into 2 cells on sheet 2 Sheet 1 cell(K2) might have something like this 774-5992 / 647-4364 or 321-774-5992 / 647-4364 I want it to be copied to sheet 2 cells (A7) & (B7) 774-5992 would be in A7, 647-4364 would be in B7. If (K2 only has one set of #s (774-5992) then nothing happens. The cells with 2 sets of #s always has / as a divider. I would like to beable to insert the code to make this happen into a recorded macro. that copies other cell information from sheet 1 into sheet 2. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
splitting date and time information in cells | Excel Discussion (Misc queries) | |||
Splitting information in cells | Excel Worksheet Functions | |||
splitting up information in a cell | Excel Discussion (Misc queries) | |||
Process for splitting information in a cell(s) | Excel Discussion (Misc queries) | |||
Splitting Information in a Cell | Excel Discussion (Misc queries) |