View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default VBA mid() function

change
Debug.Print Mid$(S, L, L)

to
Debug.Print Mid$(S, L, 1)

at least that's what I assume you want!

Regards,
Peter T

"vello" wrote in message
...
Using XP & Excel2002 to find a string in another string, gets me weird
results:
Dim S As String
Dim L As Long

S = "0123456789"
For L = 1 To 10
Debug.Print Mid$(S, L, L)
Next

The above code returns the correct value only on the 1st iteration.
Thereafter the Mid$ keeps growing.

Is there an API procedure to accomplish this? Can't seem to find it.