不带 Select 字符串大小写的大小写
Case Without Select Case for String Cases
我正在尝试 select 可以传入的每个不同字符串组合的不同大小写。在这种情况下,我使用棒球位置的缩写。
为了方便起见,我添加了一个名为 "Position" 的字符串值作为比较对象。
我目前遇到错误:
Compile Error: Case without Select Case
我认为这是某种格式错误,但我无法在网上找到任何修复它的方法。
Position = "test"
Select Case Position
Case "C"
If C.DollarPerWar < Cells(i, 8).Value Then
Set C = AssignPlayer(C, CurrentPlayer)
Case "1B"
If B1.DollarPerWar < Cells(i, 8).Value Then
Set B1 = AssignPlayer(B1, CurrentPlayer)
Case "2B"
If B2.DollarPerWar < Cells(i, 8).Value Then
Set B2 = AssignPlayer(B2, CurrentPlayer)
Case "3B"
If B3.DollarPerWar < Cells(i, 8).Value Then
Set B3 = AssignPlayer(B3, CurrentPlayer)
Case "SS"
If SS.DollarPerWar < Cells(i, 8).Value Then
Set SS = AssignPlayer(SS, CurrentPlayer)
Case "LF"
If LF.DollarPerWar < Cells(i, 8).Value Then
Set LF = AssignPlayer(LF, CurrentPlayer)
Case "CF"
If CF.DollarPerWar < Cells(i, 8).Value Then
Set CF = AssignPlayer(CF, CurrentPlayer)
Case "RF"
If RF.DollarPerWar < Cells(i, 8).Value Then
Set RF = AssignPlayer(RF, CurrentPlayer)
End Select
如有任何帮助,我们将不胜感激!
在你的 if 语句中终止你的新行。它们应该是一行,如下所示:
If RF.DollarPerWar < Cells(i, 8).Value Then Set RF = AssignPlayer(RF, CurrentPlayer)
我正在尝试 select 可以传入的每个不同字符串组合的不同大小写。在这种情况下,我使用棒球位置的缩写。
为了方便起见,我添加了一个名为 "Position" 的字符串值作为比较对象。
我目前遇到错误:
Compile Error: Case without Select Case
我认为这是某种格式错误,但我无法在网上找到任何修复它的方法。
Position = "test"
Select Case Position
Case "C"
If C.DollarPerWar < Cells(i, 8).Value Then
Set C = AssignPlayer(C, CurrentPlayer)
Case "1B"
If B1.DollarPerWar < Cells(i, 8).Value Then
Set B1 = AssignPlayer(B1, CurrentPlayer)
Case "2B"
If B2.DollarPerWar < Cells(i, 8).Value Then
Set B2 = AssignPlayer(B2, CurrentPlayer)
Case "3B"
If B3.DollarPerWar < Cells(i, 8).Value Then
Set B3 = AssignPlayer(B3, CurrentPlayer)
Case "SS"
If SS.DollarPerWar < Cells(i, 8).Value Then
Set SS = AssignPlayer(SS, CurrentPlayer)
Case "LF"
If LF.DollarPerWar < Cells(i, 8).Value Then
Set LF = AssignPlayer(LF, CurrentPlayer)
Case "CF"
If CF.DollarPerWar < Cells(i, 8).Value Then
Set CF = AssignPlayer(CF, CurrentPlayer)
Case "RF"
If RF.DollarPerWar < Cells(i, 8).Value Then
Set RF = AssignPlayer(RF, CurrentPlayer)
End Select
如有任何帮助,我们将不胜感激!
在你的 if 语句中终止你的新行。它们应该是一行,如下所示:
If RF.DollarPerWar < Cells(i, 8).Value Then Set RF = AssignPlayer(RF, CurrentPlayer)