Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
change text in string
Hi Group,
Need some hints how to approach this problem; In a cell I have a text string like "10-1,10-2,10-3,10-4" or the string could be as "1-1,1-2,1-3" or even "100-1,101-2" I want the string to be converted to look like "1,2,3,4....etc Grateful for some help. Brgds CG Rosen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
change text in string
I would look at the string to find the hyphen, then take all
characters after it. MyPos = Instr(1, searchstring, "-", 1) MyString = Mid(searchstring, MyPos+1) On Oct 5, 1:02*pm, "CG Rosen" wrote: Hi Group, Need some hints how to approach this problem; In a cell I have a text string like "10-1,10-2,10-3,10-4" or the string could be as "1-1,1-2,1-3" or even "100-1,101-2" I want the string to be converted to look like "1,2,3,4....etc Grateful for some help. Brgds CG Rosen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
change text in string
On Mon, 5 Oct 2009 22:02:51 +0200, "CG Rosen" wrote:
Hi Group, Need some hints how to approach this problem; In a cell I have a text string like "10-1,10-2,10-3,10-4" or the string could be as "1-1,1-2,1-3" or even "100-1,101-2" I want the string to be converted to look like "1,2,3,4....etc Grateful for some help. Brgds CG Rosen Assuming what you want is the number following a hyphen, and terminated by a comma or the end of the line, then: =================== Const s1 As String = "1-1,1-2,1-3" Dim a() As String Dim s As String Dim i As Long a = Split(s1, ",") For i = 0 To UBound(a) a(i) = Split(a(i), "-")(1) Next i s = Join(a, ",") Debug.Print s ================= --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change text in string | Excel Programming | |||
How to change font color on string/text values | Excel Programming | |||
Change a 1,2,3 or 4 digit number to a 6 character text string | Excel Worksheet Functions | |||
Change 3 letter text string to a number string | Excel Discussion (Misc queries) | |||
How to change text string? | Excel Discussion (Misc queries) |