What module is the code in, and what worksheet contains the active cell?
The Range keyword is not qualified here. That is, it is not prefaced by what worksheet it refers to, like this
Without qualification in a Module (like Module1) Range refers to the active sheet.
Without qualification in a Worksheet module (like Sheet1) Range refers to the sheet for that module.
If your code is defaulting to one sheet but the ActiveCell is in another sheet, that code will cause an error.
On preview, I see that TMS makes a good point. The code could be written more simply as
but that is not the source of the error you are getting.
Bookmarks