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.
|