Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default separeting a string

hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default separeting a string

one way

Sub findnonnum()
For Each c In Selection
mc = 0
For i = 1 To Len(c)
If Not IsNumeric(Mid(c, i, 1)) Then Exit For
mc = mc + 1
Next i
c.Offset(, 1) = Left(c, mc)
c.Offset(, 2) = Right(c, Len(c) - mc)
Next c
End Sub

--
Don Guillett
SalesAid Software

"oercim" wrote in message
oups.com...
hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default separeting a string

try this one just select ur column and then run kode
splitting the numerich part - the rest im working on it


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal: myVal = ""
Next

End Sub





"oercim" skrev:

hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default separeting a string

got it now - Don leaded me in the right direction :-)


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal ': myVal = ""
Cells(t, col + 2) = Right(x, Len(x) - Len(myVal))
myVal = ""
Next

End Sub



"excelent" skrev:

try this one just select ur column and then run kode
splitting the numerich part - the rest im working on it


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal: myVal = ""
Next

End Sub





"oercim" skrev:

hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default separeting a string

Thanks a lot Don and Excellent
excelent wrote:
got it now - Don leaded me in the right direction :-)


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal ': myVal = ""
Cells(t, col + 2) = Right(x, Len(x) - Len(myVal))
myVal = ""
Next

End Sub



"excelent" skrev:

try this one just select ur column and then run kode
splitting the numerich part - the rest im working on it


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal: myVal = ""
Next

End Sub





"oercim" skrev:

hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default separeting a string

glad to help

--
Don Guillett
SalesAid Software

"oercim" wrote in message
oups.com...
Thanks a lot Don and Excellent
excelent wrote:
got it now - Don leaded me in the right direction :-)


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal ': myVal = ""
Cells(t, col + 2) = Right(x, Len(x) - Len(myVal))
myVal = ""
Next

End Sub



"excelent" skrev:

try this one just select ur column and then run kode
splitting the numerich part - the rest im working on it


Sub test()

Dim rk, col, t, x, v, myVal
col = ActiveCell.Column
rk = Cells(65500, col).End(xlUp).Row
For t = 1 To rk
x = Cells(t, col)
For v = 1 To Len(x)
If Not IsNumeric(Mid(x, v, 1)) Then Exit For
myVal = myVal & Mid(x, v, 1)
Next
Cells(t, col + 1) = myVal: myVal = ""
Next

End Sub





"oercim" skrev:

hello. I have a column where the each cell consists
strings like,

column
----------------
12
3/4
2-7
3b
8/n
L45

I have alot of such cells possible more than 10000
cells in the column. Now i want to separate each string untill not
finding a numeric. For example, for the above cells, i want to have
two
such columns:
columns1 columns2
--------------- ---------------
12
3 /4
2 -7
3 b
8 /n
L45
How can i do such a thing? Thanks lot.





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
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
Importing Long String - String Manipulation (INVRPT) (EDI EANCOM 96a) Brian Excel Programming 3 February 9th 06 03:38 PM
Importing Long String - String Manipulation (EDI EANCOM 96a) Brian Excel Programming 6 February 9th 06 12:27 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
Create a formula into a String then assign string to a cell Myrna Larson[_2_] Excel Programming 6 August 23rd 03 09:42 PM


All times are GMT +1. The time now is 03:54 AM.

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"