ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 97 - Clear Method Of Range Object Failed (https://www.excelbanter.com/excel-programming/277932-re-excel-97-clear-method-range-object-failed.html)

Dave Peterson[_3_]

Excel 97 - Clear Method Of Range Object Failed
 
Are you running this from a commandbutton on the worksheet?

If yes, there's a bug in xl97 (fixed in xl2k). Set the .takefocusonclick
property of that button to false.

If you're running this from a control from the controltoolbox toolbar that
doesn't have that property, just add a line like this at the top of your code:

activecell.activate



Ron Bishop wrote:

I have an application that was developed in Excel 2000 and
works fine on all users pcs that are running Excel 2000.
On one user who is still using Excel 97, the application
fails on a line of code that reads "sheet2.cells.clear"
with the message "Clear method of range object failed."

The strange thing is that the same procedure executes the
same code for sheet1 at an earilier point in the procedure
and does not produce the error.

Thanks


--

Dave Peterson


Ron Bishop

Excel 97 - Clear Method Of Range Object Failed
 
I am running the code from a commandbutton but I have
already set the TakeFocusOnClick property to false and
still have the problem. The code is in a form module, not
a sheet module. Like I said in my original post, the
first code instance of "sheet1.cells.clear" works fine but
when it gets to the second instance it fails. I will try
making the sheet that I am clearing the active sheet
before each instance of the code and see if that helps.

Thanks

-----Original Message-----
Are you running this from a commandbutton on the

worksheet?

If yes, there's a bug in xl97 (fixed in xl2k). Set

the .takefocusonclick
property of that button to false.

If you're running this from a control from the

controltoolbox toolbar that
doesn't have that property, just add a line like this at

the top of your code:

activecell.activate



Ron Bishop wrote:

I have an application that was developed in Excel 2000

and
works fine on all users pcs that are running Excel 2000.
On one user who is still using Excel 97, the application
fails on a line of code that reads "sheet2.cells.clear"
with the message "Clear method of range object failed."

The strange thing is that the same procedure executes

the
same code for sheet1 at an earilier point in the

procedure
and does not produce the error.

Thanks


--

Dave Peterson

.


Dave Peterson[_3_]

Excel 97 - Clear Method Of Range Object Failed
 
Any chance that the sheet protection changed? Or something happened to the
codename (so sheet1 doesn't exist)?

Ron Bishop wrote:

I am running the code from a commandbutton but I have
already set the TakeFocusOnClick property to false and
still have the problem. The code is in a form module, not
a sheet module. Like I said in my original post, the
first code instance of "sheet1.cells.clear" works fine but
when it gets to the second instance it fails. I will try
making the sheet that I am clearing the active sheet
before each instance of the code and see if that helps.

Thanks

-----Original Message-----
Are you running this from a commandbutton on the

worksheet?

If yes, there's a bug in xl97 (fixed in xl2k). Set

the .takefocusonclick
property of that button to false.

If you're running this from a control from the

controltoolbox toolbar that
doesn't have that property, just add a line like this at

the top of your code:

activecell.activate



Ron Bishop wrote:

I have an application that was developed in Excel 2000

and
works fine on all users pcs that are running Excel 2000.
On one user who is still using Excel 97, the application
fails on a line of code that reads "sheet2.cells.clear"
with the message "Clear method of range object failed."

The strange thing is that the same procedure executes

the
same code for sheet1 at an earilier point in the

procedure
and does not produce the error.

Thanks


--

Dave Peterson

.


--

Dave Peterson



All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com