Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
splitting date and time information in cells mebsmith Excel Discussion (Misc queries) 5 August 26th 08 09:06 PM
Splitting information in cells Zippy Excel Worksheet Functions 7 August 15th 08 01:38 PM
splitting up information in a cell dmedina Excel Discussion (Misc queries) 1 July 21st 08 09:04 PM
Process for splitting information in a cell(s) yamefui Excel Discussion (Misc queries) 7 January 6th 07 04:19 AM
Splitting Information in a Cell Mad Dog Excel Discussion (Misc queries) 3 February 2nd 06 06:33 PM


All times are GMT +1. The time now is 07:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"