When you use .Offset, the leading dot tells the compiler that you have a preceding With statement to specify what is supposed to come before the dot. In your case it looks like what you intend is
ActiveCell.Offset
If you make that change I think your code will work.
However, it is generally not necessary and not a good programming practice in Excel to use ActiveCell to navigate a range. This is for two reasons:
- When you change ActiveCell, the user sees it changing. This can be disconcerting to a user and takes a lot more execution time.
- Your code may not always have control over which cell is active.
Here is a rewrite of your code to eliminate ActiveCell. I also cleaned up the indentation.
Bookmarks