Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default String to be split

Hi,

I have the string in the Excel file where the
"\abc*aa**11111_aa*125.00*125.00*0.0\ " I need to split this data from the
long string stored in the cell. Sometime the above marked string is broken to
next row. how do I split this in macro & to find out when it is split in the
different but continuous row.

Split required are
Col A -111111_aa
Col B -125.00
col C-125.00
Col D-0.00

Thanks & regards,
yagna.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default String to be split

On 15 dic, 08:07, yagna wrote:
Hi,

I have the string in the Excel file where the *
"\abc*aa**11111_aa*125.00*125.00*0.0\ " I need to split this data from the
long string stored in the cell. Sometime the above marked string is broken to
next row. how do I split this in macro & to find out when it is split in the
different but continuous row.

Split required are
Col A -111111_aa
Col B -125.00
col C-125.00
Col D-0.00

Thanks & regards,
yagna.


Hello.

This macro can help you:

Sub split()
textstring = "\abc*aa**11111_aa*125.00*125.00*0.0\ "
a = split(Replace(textstring, "\", ""), "*")
For cont = LBound(a) To UBound(a)
On Error Resume Next
If IsNumeric(Left(a(cont), 1)) Then
desr = desr + 1
With ActiveCell.Offset(desr, 0)
.NumberFormat = "@"
.Value = a(cont)
End With
End If
Next
End Sub

Regards,

Benito
Barcelona
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default String to be split

Here is another way to do what you want...

Sub SplitTextString()
Dim X As Long, TextString As String, Parts() As String
TextString = "\abc*aa**11111_aa*125.00*125.00*0.0\ "
Parts = Split(Trim(Replace(TextString, "\", "")), "*")
For X = UBound(Parts) - 3 To UBound(Parts)
Cells(1, X - 2).Value = Parts(X)
If X 3 Then Cells(1, X - 2).NumberFormat = "0.00"
Next
End Sub

--
Rick (MVP - Excel)


"yagna" wrote in message
...
Hi,

I have the string in the Excel file where the
"\abc*aa**11111_aa*125.00*125.00*0.0\ " I need to split this data from the
long string stored in the cell. Sometime the above marked string is broken
to
next row. how do I split this in macro & to find out when it is split in
the
different but continuous row.

Split required are
Col A -111111_aa
Col B -125.00
col C-125.00
Col D-0.00

Thanks & regards,
yagna.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default String to be split

I forgot to generalize all the code; use this macro instead of the one I
posted before...

Sub SplitTextString()
Dim X As Long, TextString As String, Parts() As String
TextString = "\abc*aa**11111_aa*125.00*125.00*0.0\ "
Parts = Split(Trim(Replace(TextString, "\", "")), "*")
For X = UBound(Parts) - 3 To UBound(Parts)
Cells(1, X - UBound(Parts) + 4).Value = Parts(X)
If X UBound(Parts) - 3 Then Cells(1, X - _
UBound(Parts) + 4).NumberFormat = "0.00"
Next
End Sub

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Here is another way to do what you want...

Sub SplitTextString()
Dim X As Long, TextString As String, Parts() As String
TextString = "\abc*aa**11111_aa*125.00*125.00*0.0\ "
Parts = Split(Trim(Replace(TextString, "\", "")), "*")
For X = UBound(Parts) - 3 To UBound(Parts)
Cells(1, X - 2).Value = Parts(X)
If X 3 Then Cells(1, X - 2).NumberFormat = "0.00"
Next
End Sub

--
Rick (MVP - Excel)


"yagna" wrote in message
...
Hi,

I have the string in the Excel file where the
"\abc*aa**11111_aa*125.00*125.00*0.0\ " I need to split this data from
the
long string stored in the cell. Sometime the above marked string is
broken to
next row. how do I split this in macro & to find out when it is split in
the
different but continuous row.

Split required are
Col A -111111_aa
Col B -125.00
col C-125.00
Col D-0.00

Thanks & regards,
yagna.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default String to be split

I wonder what "*" means and what "Sometime the above marked string is
broken to next row" means. Is the marked string, in your case, "aa",
"111111_aa", "125.00", "125.00" and "0.0"? Is the "*" just a delimiter
or something else? Do you just want to find the strings of 111111_aa,
125.00 and 0.00 in a long string in the cells or something else?

Keiji

yagna wrote:
Hi,

I have the string in the Excel file where the
"\abc*aa**11111_aa*125.00*125.00*0.0\ " I need to split this data from the
long string stored in the cell. Sometime the above marked string is broken to
next row. how do I split this in macro & to find out when it is split in the
different but continuous row.

Split required are
Col A -111111_aa
Col B -125.00
col C-125.00
Col D-0.00

Thanks & regards,
yagna.

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
Split up delimited string & insert row below James Excel Programming 1 September 23rd 09 11:28 PM
Split string into seperate cells keri Excel Programming 8 April 13th 07 03:16 PM
Split a string dealwi8me Excel Programming 4 June 18th 06 02:16 PM
Using Split Function on String with no spaces ExcelMonkey Excel Programming 7 February 9th 06 03:10 PM
how to split a string and return array xiang[_9_] Excel Programming 1 December 14th 05 11:48 AM


All times are GMT +1. The time now is 01:57 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"