WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Excel unlock some cells in a protected worksheet

Keywords:   unlocok cells protected worksheet

Question:

I know how to unprotect/protect worksheet, etc, but I do not know how to just change the locked status of some cells, so that they can be unlocked when the sheet is protected again..? Any clues?

And how do I find out things like this?

I tried writing a macro, editing it, and translating it, but no joy...

Thanks heaps in Advance!

Answer:

The example below comes from the VBAXL8.hlp file which should be installed with Office 97/2000. In general, look for VBA*.hlp on either your computer or the CD (they are no always installed)
===============================
This example unlocks cells A1:G37 on Sheet1 so that they can be modified when the sheet is protected.

Worksheets("Sheet1").Range("A1:G37").Locked = False
Worksheets("Sheet1").Protect
================================
so your Winbatch code might look something like:
EASptct = EAS.ProtectContents
If EASptct == -1 then EAS.Unprotect 
('password')

zRange=EAS.Range("b26:b29")
zRange.select
zRange.locked=@FALSE



Article ID:   W14693
Filename:   Excel unlock some cells in a protected worksheet.txt
File Created: 2000:07:17:11:11:28
Last Updated: 2000:07:17:11:11:28