It is always a good idea to ensure that variable name checking is enabled, AND your code compiles (at least compilation has been attempted), before submitting a question.
This avoids asking questions which are much more easily resolved on your own PC than on a forum.
To ensure variable name checking is enabled for all new modules, go to - Tools / Options / Editor (from the VBA Editor window) and set
Require Variable Declaration to True (checked). For existing modules, ensure that the
Option lines at the very top include :
To compile your project, select (again from the VBA Editor window) Debug / Compile
Project Name.
We
ARE generally happy to help with compilation problems too (If you find an error reported and you can't resolve it, let us know), but we do expect members to have tried compiling before submitting a question. That way we have a better idea of the sort of problem we're looking at.
I expect you wouldn't have needed to post the question if you'd done this first.