With Microsoft Excel VBA, can you access one sheet from another?
excel, vba
Solution
That is because the `Cells` Object is not fully qualified.
Change your code to
Sheet1.Range(Sheet1.Cells(1, 1), Sheet1.Cells(101, 101)).Value = ""
Problem
I'm writing some Excel VBA code and one section displays a message by selecting an entire sheet which then pops up with the desired text, Sheet2 if you like. However, the following code then refuses to run with complaint: ``` Method 'Range' of object '_Worksheet' failed. ``` In the code being called I still refer to the sheet I try to modify with Sheet1, for example `Sheet1.Range(Cells(1, 1), Cells(101, 101)).Value = ""`, but to no avail. What am I doing wrong please?