Jody,
Here is an idea...
'---------------------------------
Function FirstTwoSections(ByRef strInput As String)
'Returns the portion of a provided string that occurs before the
'second dot. If only one dot then entire string is returned.
'Jim Cone - San Francisco - USA - 12/26/2005.
Dim strResult As String
Dim lngLength As Long
Dim lngN As Long
lngLength = 0
For lngN = 1 To 2
lngLength = InStr(lngLength + 1, strInput, ".", vbTextCompare)
Next
If lngLength 0 Then
strResult = Left$(strInput, lngLength - 1)
Else
lngLength = InStr(1, strInput, ".", vbTextCompare)
If lngLength 0 Then
strResult = strInput
Else
strResult = "No dots "
End If
End If
FirstTwoSections = strResult
End Function
'Calls Function
Sub GetNumber()
Dim strFromCombo As String
strFromCombo = "1.22.333.444"
Msgbox FirstTwoSections(strFromCombo)
End Sub
'----------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
"ssjody" wrote in message
oups.com
On a Form I have a Combo Box that lists values like this
1.2.3.4
10.11.12.13
90.121.92.93
where the "." periods are my delimiter
I want to extract only the 1st two octets and write them to a
worksheet.
What code could I use to extract based on a delimiter? For example if I
pick the 1st example in my list, the 1.2 would be extracted and set as
the value to write to my worksheet. If the 2nd example was chosen,
10.11 would be written.
Any Ideas?
Jody