Include the line Exit Sub after the msgbox. It will prevent the rest of the code from executing.(If that is not what you want, then please explain it... ) ...