04-28-2011, 11:41 AM
there could be an optimized way for this.
this is what i can have now, see the code below if it helps
this is what i can have now, see the code below if it helps
Code:
msgbox RepeatedNumberCount(1,1000,"1")
Function RepeatedNumberCount(StartLimit,EndLimit,NumbertoSearch)
RepeatedNumberCount = 0
Dim sNum
For Num = StartLimit to EndLimit
sNum = cstr(Num)
If instr(sNum,NumbertoSearch) Then
For n = 1 to Len(sNum)
CurNum = Mid(sNum,n,1)
If CurNum = NumbertoSearch Then nCount = nCount + 1
Next
End If
Next
RepeatedNumberCount = nCount
End Function