myNumber="12345678"
for i=9 to 0 step -1
j=instr(1,myNumber,i)
if j<>0 then msgbox "最大数是:" & i & ",在第" & j & "位.":exit for
next
这个是个比较算法
STRNUM="52965412"
MAXNUM=0
MAXSPACE=1
for i=1 to 8 step 1
a1=mid(strnum,i+1,1)
if a1>MaxNum then
MaxNum=a1
maxspace=i
end if
next
msgbox maxspace