How to prevent users from selecting protected cells in XL97 ?

M

Marvin Hlavac

Hi,

I created a workbook in ExcelXP but when I put it on a XL97 pc protected
cells can be selected. Is there a way to correct this other
then upgrade XL?

Thanks a million in advance.
 
R

Ron de Bruin

Hi Marvin

You can do it with VBA code

If you copy this event in the Thisworkbook module
http://www.mcgimpsey.com/excel/modules.html

It will run automatic when you open the workbook and
Protect each sheet in the workbook and set the EnableSelection

Test it on a test workbook

Private Sub Workbook_Open()
Dim Sh As Worksheet
Application.ScreenUpdating = False
For Each Sh In ThisWorkbook.Worksheets
Sh.Select
Sh.Protect userinterfaceonly:=True
Sh.EnableSelection = xlUnlockedCells
Next
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
 
M

Marvin Hlavac

Hi Ron,

I'm just on my way home and will try it as soon as I arrive. Thanks a lot. I
worried I would have to upgrade our work pc to ExcelXP.
 
M

Marvin Hlavac

If you copy this event in the Thisworkbook module


Hi Ron,

I just installed it on our old Excel97 machine at work and now it finally
works as it was designed to work. Thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top