注册 登录
编程论坛 VB6论坛

怎么提示next没有for

青年刘 发布于 2015-04-13 11:37, 3227 次点击
For g3 = 9 To 1 Step -1
  If Text11(g3) = "0" Then
   If Text21(g3 - 2) = "%" Then
    If Text21(g3 - 3) = "%" Then
     k4 = Mid(Text11(g3 - 4).Text, 2, 1)
     k5 = Mid(Text11(g3 - 2).Text, 2, 1)
     k6 = Mid(Text11(g3 - 3).Text, 2, 1)
     k7 = Mid(Text11(g3 - 1).Text, 2, 1)
     Text18.Text = Text31.Text
     Text33.Text = sum
     Text19.Text = Text31.Text
     Text46.Text = k7 + k5
     Text20.Text = 2
     Text47.Text = k6
     Text22.Text = 3
     Text48.Text = k4
     Text23.Text = 4
     Text49.Text = sum - k1 - k2 - k3 - k4
     Text24.Text = Text22.Text
     Text38.Text = k4
     Text25.Text = Text31.Text
     Text51.Text = Text48.Text
     Text26.Text = Text20.Text
     Text40.Text = Text47.Text
     Text27.Text = Text31.Text
     Text53.Text = Text47.Text
     Text28.Text = Text23.Text
     Text42.Text = Text49.Text
     Text29.Text = Text31.Text
     Text55.Text = Text49.Text
    Else
     Text33.Text = sum
     Text18.Text = Text31.Text
     Text2.Text = 1
   End If
  Else
     Text33.Text = sum
     Text18.Text = Text31.Text
     Text2.Text = 1
 End If
Next g3
怎么老提示next没有for 怎么改
9 回复
#2
lianyicq2015-04-14 10:24
你这工程好庞大,眼睛又花了。
既然这么多IF,从内到外一层一层剥
最内层剥掉后:
For g3 = 9 To 1 Step -1
  If Text11(g3) = "0" Then
   If Text21(g3 - 2) = "%" Then
    ...
  Else
     Text33.Text = sum
     Text18.Text = Text31.Text
     Text2.Text = 1
End If
Next g3
次内层剥掉后:
For g3 = 9 To 1 Step -1
  If Text11(g3) = "0" Then
   ...
Next g3
看出问题了吧。
#3
wube2015-04-14 11:50
若编程时不爱排版对齐建议装一套辅助程式,能帮你对齐,才不至于出现1楼这种状况.

辅助程式
只有本站会员才能查看附件,请 登录


线条对齐
只有本站会员才能查看附件,请 登录
#4
梦千殇2015-04-14 15:08
建议没此写完一个for next 语句对齐一次,这样不至于出现乱的情况,用shift + tab键可以帮助多行对齐。
#5
梦千殇2015-04-14 15:20
回复 3楼 wube
你这个软件在哪下载的,可以给我发一下吗?178515923@ 谢谢了

[ 本帖最后由 梦千殇 于 2015-4-14 15:24 编辑 ]
#6
梦千殇2015-04-14 15:20
回复 3楼 wube
你这个软件在哪下载的,可以给我发一下吗??178515923@ 谢谢了
#7
wube2015-04-14 16:06
很久以前在CSDN抓的
http://download.
只有本站会员才能查看附件,请 登录
#8
青年刘2015-04-15 09:34
回复 2楼 lianyicq
哦,谢谢你。已经解决了问题。
#9
青年刘2015-04-15 09:36
回复 3楼 wube
就是没有对齐,所以才老出现这问题,我对齐之后就不报错了
#10
刘叶全2022-06-13 21:22
是没有对齐格式吗
1