1 / 2100%
1) Describe the problem:
I would like to do an evaluation about if education is important that requires students to
reply yes.
2) Make a plan:
a) I would like to have a Popup message box appear with the message, Is Education
important in todays life?
b) I would like to have the users select YES or NO to answer the question.
c) If the answer is YES, then I would like for cell A1 to say, EDUCATION IS
ABSOLUTELY A NEED!” in big bold letters.
d) If the answer is NO, then I would like for cell A1 to say, EDUCATION IS
IMPORTANT AND WE ARE LEARNING EVERY DAY!” in big bold letters.
e) I want to make a restart from the beginning if the users answer is NO.
3) Coding:
Private Sub Private Sub Yes_No_MsgBox()
Dim answer As Integer
answer = MsgBox("Is Education important in todays life?", vbYesNo + vbExclamation,
"Education Evaluation")
If answer = vbYes Then
With Range("B2")
.Value = "EDUCATION IS ABSOLUTELY A NEED!"
.Font.Color = vbGreen
.Font.Bold = True
.Font.Size = 18
End With
Else
With Rang("B2")
.Value = "EDUCATION IS IMPORTANT AND WE ARE LEARNING EVERY DAY!"
.Font.Color = vbRed
.Font.Bold = True
.Font.Size = 18
End With
Call Yes_No_MsgBox
End If
End Sub
4) Debug:
My code ran smoothly and I understand that Education is Important.” OR I had an
issue of getting the right answer and it kept repeating until I understand my question to
reply it correctly. I figured out that Education is everywhere in our lives, we learn
different things every day and its important to us to live in a better future.
5) Testing and Documentation:
This is the name of the function that will run the code
Private Sub Private Sub Yes_No_MsgBox()
This creates the variable answer that I will use later to record the response from the
MsgBox
Dim answer As Integer
This is when the Message Box pops up with the yes or no button.
answer = MsgBox("Is Education important in todays life?", vbYesNo +
vbExclamation, "Education Evaluation")
This checks to see if the answer was yes or no
If it is Yes then it will follow these specific commands
If answer = vbYes Then
If yes then Cell B2 is going to say Correct, Education is ABSOLUTELY a Need!” with
green color, in size 18, and font bold letters.
With Range("B2")
.Value = "Correct, Education is ABSOLUTELY a Need!"
.Font.Color = vbGreen
.Font.Bold = True
.Font.Size = 18
End With
Or else, if the user clicks NO then Cell B2 is going to say WRONG, Education is
IMPORTANT and we are LEARNING EVERY DAY!” with red color, in size 18, and
font bold letters.
Else
With Range("B2")
.Value = "WRONG, Education is IMPORTANT and we are LEARNING EVERY
DAY!"
.Font.Color = vbRed
.Font.Bold = True
.Font.Size = 18
End With
This will recall the function again if the user answers NO, the question will be repeated
until they reply YES.
Call Yes_No_MsgBox
End If
End Sub
Powered by TCPDF (www.tcpdf.org)
Students also viewed