View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Hank Scorpio Hank Scorpio is offline
external usenet poster
 
Posts: 103
Default Excel VBA - Problems using Protect/Unprotect a worksheet

On Thu, 5 Feb 2004 21:14:54 -0600, Gary Richie
wrote:

Add the command Activecell.Select before you try the unprotect method.
There's a known issue with command buttons taking the focus in Excel
97 which often causes the kind of problem you're referring to.

I am having problems toggling the Protect mode on a spreadsheet. I can
Protect/Unprotect from the Tools menu.

The workbook is not protected nor is it shared.

When I execute my macro I get the following error message:

Run-time error '1004':

Unprotect method of Worksheet class failed

The message occurs when I execute either of the following:

- Sheets("SheetName").Unprotect
- Worksheets("SheetName").Unprotect

The macro is executed by clicking on a button on the worksheet.

I am running Excel 97.


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *