我可以帮您完成以下任务:
write the message "Are you awake?" and display a question mark
capture the response in the integer variable intR, put intR value in cell A2
If the response is Yes, then write in cell A1 "Hurray"
If the response is No, then write a message box with the text "ZZZZZZZZ"
If the response is Cancel, then exit the sub
Sub EX3_1_6MsgBoxFunction() Dim intR As Integer Dim TxtRng As Range Dim stra As String Dim stra2 As String 'Have the message box display the buttons Yes, No and Cancel intR = MsgBox("Are you awake ? ", vbQuestion + vbYesNoCancel) intR = Range("a2") If intR = vbYes Then Range("a1") = "Hurray" 'that means yes ElseIf intR = vbNo Then stra2 = MsgBox("ZZZZZZZZZZ") Else Range("a2") = intR End If End Sub
intR = Range("a2")
写成了Range("a2").Value = intR
。 - YowE3K