作者:嘻嘻2502891803 | 来源:互联网 | 2023-05-23 18:34
对于这个if-without-end
问题,如果你使用else if
(两个单词),每个人都 if
需要相应的end if
.您应该使用elseif
(一个单词)变体来编码.看看这两者之间的区别:
if a = 1 then if a = 1 then
b = 2 b = 2
else elseif a = 2 then
if a = 2 then b = 1
b = 1 else
else b = 0
b = 0 end if
end if
end if
对于这个next-without-for
问题,你应该end if
用来关闭你的if
陈述,而不仅仅是end
你现在拥有的陈述:
If GroupChoice = 1 Then
For row = 1 To 15
group1Late = "A" & row
MEG1Late = "AD" & row
If ActiveSheet.Cells(row, 1).Value = "" Then
Range("group1Late") = StudentName
Range("MEG1Late") = MEGChoice
End If ' <-- HERE '
Next
End If ' <-- AND HERE '
End
本身用于停止程序.
我怀疑的错误是由不均衡性你造成的for-next
,并if-end if
,VB是看到他们交错,因为没有end if
那么它假定谈到某处后的next
.
1> paxdiablo..:
对于这个if-without-end
问题,如果你使用else if
(两个单词),每个人都 if
需要相应的end if
.您应该使用elseif
(一个单词)变体来编码.看看这两者之间的区别:
if a = 1 then if a = 1 then
b = 2 b = 2
else elseif a = 2 then
if a = 2 then b = 1
b = 1 else
else b = 0
b = 0 end if
end if
end if
对于这个next-without-for
问题,你应该end if
用来关闭你的if
陈述,而不仅仅是end
你现在拥有的陈述:
If GroupChoice = 1 Then
For row = 1 To 15
group1Late = "A" & row
MEG1Late = "AD" & row
If ActiveSheet.Cells(row, 1).Value = "" Then
Range("group1Late") = StudentName
Range("MEG1Late") = MEGChoice
End If ' <-- HERE '
Next
End If ' <-- AND HERE '
End
本身用于停止程序.
我怀疑的错误是由不均衡性你造成的for-next
,并if-end if
,VB是看到他们交错,因为没有end if
那么它假定谈到某处后的next
.