怎么把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 语句替换掉啊,然后还能运行
求求了