Function CountStr(somestr, target) Dim a, count As Integer a = InStr(1, somestr, target) Do While a > 0 count = count + 1 a = InStr(a + 1, somestr, target) Loop CountStr = count End Function 运行:MsgBox CountStr("ASAASDWA", "A") '=4 MsgBox CountStr("ASAASDWA", "B") '=0 |
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2024-5-3 13:59 , Processed in 0.056146 second(s), 16 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.