My MsgBox("success") is repeated for each comparison.
I only need it to show once, there is no need to tell
the person entering the pin that each input is good,.
Programming is about applied logic, so you should be
thinking carefully and analytically about each
activity of the code you write.
It should be obvious to you why you are showing the
messagebox multiple times: because it is inside the
loop and gets shown every time a comparison is made
on one of the digits/numbers of the entered PIN.
So the solution should also be obvious: don't
show the messagebox for each digit tested. Show
it after all of the tests are completed. Which
means you want to set an indicator that can be
tested later instead of showing the messagebox
every time a test is done.
There are various ways to code that, the choice is
yours and may depend on what you have learned to
date. Some examples:
(1) Use a simple integer variable declared before the
loop begins with an initial value of zero. If a test
fails set that variable to one (or add one to it,
etc.). After the loop exits check the value of that
variable to see if any of the individual tests failed
and display the appropriate message.
(2) The same sort of arrangement can be used but with
a boolean variable instead of a simple integer. For
example a boolean variable set to an initial state
to indicate pass/fail via true/false, gets changed
inside the loop based on the results of each test.