输入一个数字(1-7),分别通过Select和Choos函数两种方法用英文显示对应的星期一-星期日
1个回答
展开全部
Alt+F11,然后Alt+IM,在弹出窗口粘帖下面内容:
Function chooseTest(myDay As Integer) As String
chooseTest = Choose(myDay, "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Sateday", "Sunday")
chooseTest = "Choose结果:" + chooseTest
End Function
Function SelectTest(myDay As Integer) As String
Select Case myDay
Case 1
SelectTest = "Monday"
Case 2
SelectTest = "Tuesday"
Case 3
SelectTest = "Wednesday"
Case 4
SelectTest = "Thursday"
Case 5
SelectTest = "Friday"
Case 6
SelectTest = "Sateday"
Case 7
SelectTest = "Sunday"
End Select
SelectTest = "Select结果:" + SelectTest
End Function
然后回到excel,在A1填4, A2填=chooseTest(A1), A3填=selectTest(A1)可看到效果
Function chooseTest(myDay As Integer) As String
chooseTest = Choose(myDay, "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Sateday", "Sunday")
chooseTest = "Choose结果:" + chooseTest
End Function
Function SelectTest(myDay As Integer) As String
Select Case myDay
Case 1
SelectTest = "Monday"
Case 2
SelectTest = "Tuesday"
Case 3
SelectTest = "Wednesday"
Case 4
SelectTest = "Thursday"
Case 5
SelectTest = "Friday"
Case 6
SelectTest = "Sateday"
Case 7
SelectTest = "Sunday"
End Select
SelectTest = "Select结果:" + SelectTest
End Function
然后回到excel,在A1填4, A2填=chooseTest(A1), A3填=selectTest(A1)可看到效果
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询