Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 3 Mar 2005 11:49:01 -0800, "Jello"
wrote: I have serached the String class but cant see any function that can identify integers within a string ? I want to replace all instances of "Mystringwith10integer" with "Mystringwith11integer" etc. Is there such a funtion ? Many thanks, Jello Something like: ============== Sub IncrNumInStr() Const str = "Mystringwith10integer" Dim i As Long Dim FirstPart As String Dim LastPart As String Dim Num As Long For i = 1 To Len(str) If IsNumeric(Mid(str, i, 1)) Then FirstPart = Left(str, i - 1) Num = Val(Mid(str, i, 255)) Exit For End If Next i For i = i To Len(str) If Not IsNumeric(Mid(str, i, 1)) Then LastPart = Mid(str, i, 255) Exit For End If Next i Debug.Print FirstPart & Num + 1 & LastPart End Sub ================== --ron |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract numbers from a string of text | Excel Discussion (Misc queries) | |||
Extract numbers from a string of text | Excel Discussion (Misc queries) | |||
HOW DO I EXTRACT NUMBERS FROM TEXT STRING | Excel Discussion (Misc queries) | |||
extract numbers from a string | Excel Worksheet Functions | |||
Only extract numbers from a string of text | Excel Discussion (Misc queries) |