Dim MyValue,result,You,Youte,compu Do You=inputBox("あなたの手を決定して入力してください。" & vbCR _ & "グー:1 チョキ:2 パー:3 を入力。") If You <> "" Then Randomize ' 乱数初期化 MyValue = Int((3 * Rnd) + 1) ' 1 〜 3 のランダムな値を生成 If You = "1" Then If MyValue = 1 Then result="Even!" ElseIf MyValue = 2 Then result="You Win!" ElseIf MyValue = 3 Then result="You Lose!" End If ElseIf You = "2" Then If MyValue = 1 Then result="You Lose!" ElseIf MyValue = 2 Then result="Even!" ElseIf MyValue = 3 Then result="You Win!" End If ElseIf You = "3" Then If MyValue = 1 Then result="You Win!" ElseIf MyValue = 2 Then result="You Lose!" ElseIf MyValue = 3 Then result="Even!" End If End If If You="1" Then Youte="グー" ElseIf You="2" Then Youte="チョキ" ElseIf You="3" Then Youte="パー" End if If MyValue=1 Then compu="グー" ElseIf MyValue=2 Then compu="チョキ" ElseIf MyValue=3 Then compu="パー" End If res=MsgBox ("You:" & Youte & " Computer:" & compu & " 判定:" & result,vbOKCancel) Else msgbox("入力がありませんでした。終了します。") Exit Do End If Loop While res=vbOK 'OKなら続ける。キャンセルなら終了