Dim i As IntegerDim x As IntegerDim y As IntegerDim a As StringDim c As IntegerDim b As IntegerDim e As IntegerDim f As IntegerDim d As Integeri = 0Dim z As IntegerFor j = 1 To 15 Step 1f = Mid(Text1.Text, j, 1)If f = "/" Theny = y + 1If y <> 15 ThenText2.Text = "标签缺少数据,请录入数据后再试!"ElsePrint yEnd IfIf Trim(Text1.Text) = "" ThenText2.Text = "请输入数据。"ElseFor i = 1 To 15 Step 1a = Text1.Textx = InStr(Text1.Text, "//")c = InStr(Text1.Text, "#/")d = InStr(Text1.Text, "/#")f = InStr(Text1.Text, "##")If x <> 0 Or d = 0 Or c <> 0 Or f <> 0 Or y <> 15 ThenText2.Text = "标签格式错误或者缺少数据,请重新输入"c = InStr(Text1.Text, "#/")ElseText2.Text = "标签OK,可以出货。"End IfNext iEnd Sub
1 回答

Qyouu
TA贡献1786条经验 获得超11个赞
For与Next是成对使用的,你发的程序中有2个For、1个Next,不匹配。目测,你丢了一个Next j。程序会报错。
If与EndIf也是成对使用的,程序中有4个If,可是只有2个EndIf。也会报错。
你只能根据程序的作用和逻辑关系,在适当的位置补充足够数量的Next和EndIf,就能接近问题。
希望能帮到你。
添加回答
举报
0/150
提交
取消