Good evening friends:
I have in mind 2 ways for clearing a content in a defined range of cells of a VBA project (in MS Excel):
Worksheets("SheetName").Range("A1:B10").ClearContents
Worksheets("SheetName").Range(Cells(1, 1), Cells(10, 2)).ClearContents
The problem is that the second way show me an error '1004' when I'm not watching the current Worksheet "SheetName" (in other words, when I haven't "SheetName" as ActiveSheet).
The first way work flawlessly in any situation.
Why does this happen? How can I use the "Second way" without this bug?