hendrik1985
New Member
- Joined
- Jul 10, 2010
- Messages
- 4
Hi All,
In VBA I need to have a code which shows a number with the following format:
##.##.####
This must replace the Find.Spec formula, which is not available in VBA and I can not get the InStr function working with wildcards.
See example of the current status below.
I now have the following function:
If a string contains a ".", then find the position of this "." and display a string with a length of 10, starting 2 signs before the found ".".
Now, the code needs to recognize only numbers instead of text. Line 3 in my attached example doesnt show up with the result I want. It needs to provide the same code as in the first line.
I hope my point is clear. Who can help me out please?
Thanks in advance!
Regards, Hendrik
In VBA I need to have a code which shows a number with the following format:
##.##.####
This must replace the Find.Spec formula, which is not available in VBA and I can not get the InStr function working with wildcards.
See example of the current status below.
I now have the following function:
Code:
Function dn(str1 As String) As String
Dim InstrWild As Long
If str1 Like "*" & "." & "*" Then
InstrWild = InStr(10, str1, Split(".", "*")(0))
End If
dn = Mid(str1, InstrWild - 2, 10)
End Function
If a string contains a ".", then find the position of this "." and display a string with a length of 10, starting 2 signs before the found ".".
Now, the code needs to recognize only numbers instead of text. Line 3 in my attached example doesnt show up with the result I want. It needs to provide the same code as in the first line.
I hope my point is clear. Who can help me out please?
Thanks in advance!
Regards, Hendrik