I can't see anything in your function that is going to pop up a second
message box. I expect the function is being called twice. Please supply
the relevant calling code too.
I do see that you have defined your routine as a function, rather than a
sub, but you are not returning a value. This is bad practice, and might
also be causing trouble at the calling end.
Also, please declare your variables and parameters as specific types. And
note that commas within a Dim statement do not cause multiple variables to
be declared with the same type - all the variables still need to be given
separate "As" statements.