excel函数编译中出现 编译错误 缺少标识符

来源:百度知道 编辑:UC知道 时间:2024/06/12 06:21:50
我刚学,各位给看看那点错了
Function tax(Income As Single) As Single
Select Case Income
Case 0 To 800
tax = 0
Case 800.01 To 1300
tax = (Income - 800) * 0.05
Case 1300.01 To 2800
tax = (Income - 1300) * 0.1 + 25
Case 2800.01 To 5800
tax = (Income - 2800) * 0.15 + 175
Case 5800.01 To 20800
tax = (Income - 5800) * 0.2 + 625
Case 20800.01 To 40800
tax = (Income - 20800) * 0.25 + 3625
Case 40800.01 To 60800
tax = (Income - 40800) * 0.3 + 8625
Case 60800.01 To 80800
tax = (Income - 60800) * 0.35 + 14625
Case 80800.01 To 100800
tax = (Income - 80800) * 0.4 + 21625
Case Is >= 100800
tax = (Income - 100800) * 0.45 + 29625
Case Is < 0
MsgBox ("你的工资输入有误")
End Select
End Function
谢谢啊,还有你给怎么加载宏,具体步骤能不能也说下啊,
然后怎么保存,怎么运用,上面这个宏,是不是写=tax()就可以啦

奇怪,没有出错呀!我只是改了一下楼主的代码格式而已。
要不LZ从我这Copy一下试试呢,内容基本一模一样。

Function tax(Income As Single) As Single
Select Case Income
Case 0 To 800
tax = 0
Case 800.01 To 1300
tax = (Income - 800) * 0.05
Case 1300.01 To 2800
tax = (Income - 1300) * 0.1 + 25
Case 2800.01 To 5800
tax = (Income - 2800) * 0.15 + 175
Case 5800.01 To 20800
tax = (Income - 5800) * 0.2 + 625
Case 20800.01 To 40800
tax = (Income - 20800) * 0.25 + 3625
Case 40800.01 To 60800
tax = (Income - 40800) * 0.3 + 8625
Case 60800.01 To 80800
tax = (Income - 60800) * 0.35 + 14625
Case 80800.01 To 100800
tax = (Income - 80800) * 0.4 + 21625
Case Is >= 100800
tax = (Income - 100800) * 0.45 + 29625
Case Is