用VBA保留特定格式,特定字符长度的字符串

2025-04-07 16:05:35
推荐回答(1个)
回答1:

function getStr(InStr as string,outArr() as string) as long
dim tempArr() as string,I as integer
redim outArr(0)
temparr() = split(inStr)
for i = 0 to ubound(temparr())
if len(tempArr(i))>4 then

redim preserve outArr(ubound(outArr())+1)

outArr(ubound(outArr()) = tempArr(i)
end if

next i
getStr = ubound(outArr())
end function