Quote Originally Posted by JosephP View Post
use a workbook variable
dim wb as workbook
set wb = activeworkbook
' code here
wb.activate
if the workbook is the one containing the code, you can just refer to ThisWorkbook instead.

Thank you very much JosephP, and thank you everybody that responded. Consider this solved!