为什么我的Elseif功能不起作用?错误消息:编译错误:其他,如果没有

时间:2019-03-13 14:43:57

标签: vba

Sub exercise2d()

Dim taxamount As String
Dim income As String

Range("A10:A11").NumberFormatLocal = "##.#0,00 ?"
income = Range("A10").Value

If income <= 12000 Then taxamount = income * 0.12
ElseIf income <= 20000 Then taxamount = income * 0.15
ElseIf income <= 30000 Then taxamount = income * 0.2
Else: taxamount = income * 0.25
End If

Range("A11").Value = taxamount

End Sub

1 个答案:

答案 0 :(得分:0)

您忘记了一些括号,显然,var str = "===========\n\n 1-test\n\n 2-ests \n\n 1 zfzrf"; var res = str.split("\n"); for (row of res) { let words = row.trim().split(' '); let firstWord = words[0].trim(); // get first character, parse to int, validate it is infact integer let element = firstWord.charAt(0); if (Number.isInteger(parseInt(element))) { console.log('Row', row); console.log('Element: ', element); } }中的命令必须放在新行:

then