读书人

VBA 字符串处理算法,该如何处理

发布时间: 2012-03-08 13:30:13 作者: rapoo

VBA 字符串处理算法
Excel 2003:
某一个字符串(比较长)遇到空格就截取某段写入到Excel表格中去
比如
Dim str as string
str="I love you more than i can say"
在表格中,第一行一列显示I,二列显示love……
这个算法要怎么写呀?

[解决办法]
1:这叫写法,不叫算法。
2:写法如下:
Dim str as string
dim strS() as string
dim i as integer

str="I love you more than i can say"
strs=split(str)
for i=0 to ubound(strs)
application.cells(1,i+1)=strs(i)
next
[解决办法]

探讨
引用:
[a1] = split(str)(0)

?就这么简单?

[解决办法]
这个是VB函数。

建议楼主需要下个MSDN的VB手册。或者EXCEL自带的VB手册。

读书人网 >VB

热点推荐