killerhaa.blogg.se

Vba find exact match
Vba find exact match






vba find exact match

I used to look for a best replace solution.

vba find exact match vba find exact match

Sub TesterDim i As Long, b, tDim arr(1 To 100) As StringFor i = 1 To 100arr(i) = 'Value' & iNext it = TimerFor i = 1 To 100000b = Contains(arr, 'Value50')Next iDebug.Print 'Contains', Timer - tt = TimerFor i = 1 To 100000b = Application.Match(arr, 'Value50', False)Next iDebug.Print 'Match', Timer - tEnd SubFunction Contains(arr, v) As BooleanDim rv As Boolean, lb As Long, ub As Long, i As Longlb = LBound(arr)ub = UBound(arr)For i = lb To ubIf arr(i) = v Thenrv = TrueExit ForEnd IfNext iContains = rvEnd FunctionOutput: Contains 0.8710938Match 4.210938.








Vba find exact match