whoistop 发表于 2012-5-21 23:10:58

这样的代码如何写得更简洁些

.Columns(1).Cells.Replace("A","甲")
.Columns(1).Cells.Replace("B","乙")
.Columns(1).Cells.Replace("C","丙")
.Columns(1).Cells.Replace("D","丁")
.Columns(1).Cells.Replace("E","戊")
.Columns(1).Cells.Replace("F","己")
.Columns(1).Cells.Replace("G","庚")数组?

魔导 发表于 2012-5-21 23:32:52

这个码不懂
看后面的应该可以用FOR

1007236046 发表于 2012-5-21 23:49:57

Local $a = [["A","B","C","D","E","F","G"],["甲","乙","丙","丁","戊","己","庚"]]
For $i = 0 To 6
        .Columns(1).Cells.Replace($a[$i],$a[$i])
Next

这个怎么样

lxz 发表于 2012-5-22 06:49:13

学习了,谢谢...

user3000 发表于 2012-5-22 09:41:56

回复 3# 1007236046
这样更简洁!
Local $a = ["甲","乙","丙","丁","戊","己","庚"]
For $i = 0 To 6          
   .Columns(1).Cells.Replace(Chr($i+65), $a[$i])
Next

fpquenya 发表于 2012-5-22 09:51:22

回复1007236046
这样更简洁!
user3000 发表于 2012-5-22 09:41 http://www.autoitx.com/images/common/back.gif

这个更简洁,学习了!

xms77 发表于 2012-5-22 12:44:58

回复 5# user3000
学习了,果然更简洁!

whoistop 发表于 2012-5-22 21:11:28

谢谢楼上各位!

whoistop 发表于 2012-5-22 21:15:07

回复 5# user3000


    因为刚好是abcd。。。所以可行,不错。
页: [1]
查看完整版本: 这样的代码如何写得更简洁些