| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1389 人关注过本帖
标题:怎么把GOTO 语句替换掉啊 求求了
取消只看楼主 加入收藏
W哇Y
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2020-10-15
收藏
 问题点数:0 回复次数:0 
怎么把GOTO 语句替换掉啊 求求了
Sub 点名过程()

'Sheets("点名").Select
  
  really = MsgBox("点名之前需要清空吗?", vbYesNo)
  If rewally = 7 Then GoTo bbb
  
qingkong:
   found = 0
   For j = 1 To 256
   If Left(Cells(1, j), 2) = "抽取" Then
       firstcol = j
       found = 1
       Exit For
    End If
Next j

If found = 0 Then
firstcol = [IV1].End(xlToLeft).Column + 1
End If


Range(Cells(1, firstcol), Cells(65536, 256)).Clear
Cells(1, firstcol).Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, skipBlanks:=False, Transpose:=False

Cells(1, firstcol) = "抽取" + Cells(1, firstcol).Text
GoTo ccc


bbb:
found = 0
For j = 1 To 256
If Left(Cells(1, j), 2) = "抽取" Then
   firstcol = j
   found = 1
   Exit For
End If
Next j
   
   
   If found = 0 Then
   firstcol = [IV1].End(xlToLeft).Column + 1
   Cells(1, firstcol).Select
   ActiveCell.FormulaR1C1 = "=TODAY()"
   Seclection.Copy
   Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, skipBlanks:=False, Transpose:=False
   Cells(1, firstcol) = "抽取" + Cells(1, firstcol).Text
Else
really = MsgBox("在最后一列继续抽吗?", vbYesNo)
If really = 7 Then
  firstcol = [IV1].End(xlToLeft).Column + 1
  Cells(1, firstcol).Select
  ActiveCell.FormulaR1C1 = "=TODAY()"
  Selection.Copy
  Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, skipBlanks:=False, Transpose:=False
  Cells(1, firstcol) = "抽取" + Cells(1, firstcol).Text
  
  
  Else
  firstcol = [IV1].End(xlToLeft).Column
  End If
  
End If
'firstcol=lastcol

ccc:
renshu = [a65536].End(xlUp).Row - 1
renci = 0
For i = 2 To renshu + 1
    If Cells(1, firstcol) = "是" Then renci = renci + 1
Next i
aaa:
 Randomize
 
 
 
 If renci = renshu Then
 MsgBox ("已经都点过了,下面将开始新一轮点名!")
 firstcol = [IV1].End(xlToLeft).Column + 1
 Cells(1, firstcol).Select
 ActiveCell.FormulaR1C1 = "=TODAY()"
 Selection.Copy
 Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, skipBlanks:=False, Transpose:=False
 Cells(1, firstcol) = "抽取" + Cells(1, firstcol).Text
 
 GoTo ccc
 End If
 chouzhongrenhao = Int(Rnd() * renshu) + 2
 If Left(Cells(chouzhongrenhao, firstcol), 1) = "是" Then
 GoTo aaa
 Else
 renci = renci + 1
 Cells(chouzhongrenhao, firstcol) = "是"
 If TypeName(Cells(chouzhongrenhao, 1)) <> "string" Then
 numl = Trim(Str(Cells(chouzhongrenhao, 1)))
 Else
 numl = Cells(chouzhongrenhao, 1)
 End If
 numel = Cells(chouzhongrenhao, 2)
 End If
 really = MsgBox(numl + Chr(10) + Chr(10) + namel + Chr(10) + Chr(10) + "抽取下一位", vbYesNo)
 Application.StatusBar = "上一位是:" + numl + " " + namel
 If really = 6 Then GoTo aaa
End Sub



怎么把GOTO 语句替换掉啊,然后还能运行
求求了

 
 
 
 
 
 

搜索更多相关主题的帖子: GOTO If End False Then 
2020-10-15 20:35
快速回复:怎么把GOTO 语句替换掉啊 求求了
数据加载中...
 
   



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

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