kroz
11-16-2010, 06:49 AM
hey all,
I have a rather fine tunning question for you. Can you guys come up with a faster code (as in less time consuming) then this one? I'm trying to find the number in a column of strings, the values can be one of the following:
S***NUMBER
S**number
S*number
I've added an extra precaution to check for the fifth char too because there may be values that i haven't found yet. This is the code i got:
If IsNumeric(Mid(.Value, 5, 1)) Then
If IsNumeric(Mid(.Value, 4, 1)) Then
If IsNumeric(Mid(.Value, 3, 1)) Then
If IsNumeric(Mid(.Value, 2, 1)) Then
aLoc = 2
End If
Else
aLoc = 3
End If
Else
aLoc = 4
End If
Else
aLoc = 5
End If
aTemp = Right(.Value, Len(.Value) - aLoc)
This would extract my text but i'm wondering if going through so many loops can be avoided.
Thanx
P.S. The * are wildchars, combination of letters.
I have a rather fine tunning question for you. Can you guys come up with a faster code (as in less time consuming) then this one? I'm trying to find the number in a column of strings, the values can be one of the following:
S***NUMBER
S**number
S*number
I've added an extra precaution to check for the fifth char too because there may be values that i haven't found yet. This is the code i got:
If IsNumeric(Mid(.Value, 5, 1)) Then
If IsNumeric(Mid(.Value, 4, 1)) Then
If IsNumeric(Mid(.Value, 3, 1)) Then
If IsNumeric(Mid(.Value, 2, 1)) Then
aLoc = 2
End If
Else
aLoc = 3
End If
Else
aLoc = 4
End If
Else
aLoc = 5
End If
aTemp = Right(.Value, Len(.Value) - aLoc)
This would extract my text but i'm wondering if going through so many loops can be avoided.
Thanx
P.S. The * are wildchars, combination of letters.