If you use Static instead of Dim when you declare the variable in your sub,the value is retained while the workbook is open. It is not visible to othersubs and is destroyed when the workbook is closed.