GCD(a,b)
if (b == 0)
return a
else
return GCD(b,a%b)
Sub Mesg()
ActiveCell.Value = MsgBox("Click on One", 3 + 512 + 16, "The Title of the Window")
End Sub
Sub Mesg2()
PromptStr = "Give Me Input"
TheButtons = 2 + 64
ATitle = "Her Royal Magesty"
msg = MsgBox(Title:=ATitle, Buttons:=TheButtons, Prompt:=PromptStr)
ActiveCell.Value = msg
End Sub
Sub EightBall()
Value = MsgBox("Speak a question for the magic 8 ball", 0, "The Magic 8 Ball")
ans = rnd()*19
Select Case ans
Case 0 To 4: msg = "yes"
Case 6 To 9: msg = "no"
Case 10 To 19: msg = "who knows"
End Select
ActiveCell.Value = msg
End Sub
Sub GetName()
Dim Name As String
Name = Application.InputBox(Prompt:="What ... is your name?", _
Type:=2, _
Default:="Arthur, King of the Britons", _
Title:="Question 1")
ActiveCell.Value = Name
End Sub
Sub EightBall2()
Value = InputBox(prompt:="Enter a question for the 8 Ball", _
Title:="The mighty 8 Ball")
Sum = Rnd() * 100
For i = 1 To Len(Value)
Sum = Asc(Mid(Value, i, 1)) + Sum
Next i
Sum = Sum Mod 20
ActiveCell.Value = Decode(Sum)
End Sub
Function Decode(i)
Select Case i
Case 0: Decode = "It is certain."
Case 1: Decode = "It is decidedly so."
Case 2: Decode = "Without a doubt."
Case 3: Decode = "Yes - definately."
Case 4: Decode = "You may rely on it."
Case 5: Decode = "As I see it, yes."
Case 6: Decode = "Most likely."
Case 7: Decode = "Outlook Good."
Case 8: Decode = "Yes."
Case 9: Decode = "Signs point to yes."
Case 10: Decode = "Reply hazy, try again."
Case 11: Decode = "Ask again later."
Case 12: Decode = "Better not Tell You"
Case 13: Decode = "Cannot predict now."
Case 14: Decode = "Concentrate and ask again."
Case 15: Decode = "Don't count on it."
Case 16: Decode = "My reply is no."
Case 17: Decode = "My sources say no."
Case 18: Decode = "Outlook not so good."
Case 19: Decode = "Very doubtful."
End Select
End Function