标题:怎样省事带入循环
只看楼主
woa
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2008-12-4
结帖率:85.37%
已结贴  问题点数:0 回复次数:2 
怎样省事带入循环
Dim y1 As String, y2 As String, y3 As String

For i = 1 To 3
y(i) = "1" '这句无效,怎样带入循环
Next i

MsgBox y1
Msgbox y2
Msgbox y3
2011-07-10 11:13
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
得分:10 
Dim y(3) As String
For i = 1 To 3
  y(i) = "1" '这句无效,怎样带入循环
Next i

MsgBox y(1)
MsgBox y(2)
MsgBox y(3)

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2011-07-10 11:41
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
得分:10 
程序代码:
Dim y(3) As String , i As Integer
    For i = 1 To 3
        y(i) = "1"
        MsgBox y(i)
    Next i


or

程序代码:
Dim y(3) As String, i As Integer
    For i = 1 To 3
        y(i) = "1"
    Next i
    MsgBox Join(y, vbCrLf)

不要選我當版主
2011-07-10 12:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-345122-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.103211 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved