Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PO PO is offline
external usenet poster
 
Posts: 66
Default How to protect formats in unprotected cells

Excel 2003, sp2

Hi

I use unprotected cells in a worksheet for data entry. In some cases the
cells are merged, and all cells have borders and cell colors. After
protecting the worksheet (see code below) the user cannot change the
unlocked cells formats. The menu command Edit-Delete-All is however still
available to be used on the unlocked cells which results in all their
formats being lost (including the merge).

I there any way to prevent this from happening?

Sub Lock_Sheet(ByRef wksSheetToLock As Excel.Worksheet)

Select Case wksSheetToLock.CodeName

Case "wksDataEntry"
wksSheetToLock.Protect _
Password:=gsSHEET_PWD, _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True

End Select
End Sub


Regards
Pete


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to protect formats in unprotected cells

I don't think so.

You could stop some of it--but I think the merged cells are going to be a
problem.

When you use Edit|Clear|All (not delete, right???), the range you just cleared
takes the format from the Normal style.

So you can modify the Normal style to be what you want.

Changing the protection to unlocked so you don't change the cleared cells to
locked is a common change.

Format|style|Select Normal and click Modify to make your changes.

But since styles live in workbooks, any workbook that needs this will have to
have the same change made.

You could change other attributes of the normal style, but that usually caused
more trouble than it's worth--for example, changing number format changes dates,
too.



PO wrote:

Excel 2003, sp2

Hi

I use unprotected cells in a worksheet for data entry. In some cases the
cells are merged, and all cells have borders and cell colors. After
protecting the worksheet (see code below) the user cannot change the
unlocked cells formats. The menu command Edit-Delete-All is however still
available to be used on the unlocked cells which results in all their
formats being lost (including the merge).

I there any way to prevent this from happening?

Sub Lock_Sheet(ByRef wksSheetToLock As Excel.Worksheet)

Select Case wksSheetToLock.CodeName

Case "wksDataEntry"
wksSheetToLock.Protect _
Password:=gsSHEET_PWD, _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True

End Select
End Sub

Regards
Pete


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
edit a comment while protect sheet is on the cell is unprotected Rubber 4 u Excel Worksheet Functions 1 February 4th 10 07:37 PM
How change unprotected cell formats on protected worksheets? John Excel Programming 2 March 3rd 06 02:31 AM
Re-protect if originally protected, leave unprotected if not? StargateFanFromWork[_3_] Excel Programming 2 January 17th 06 07:02 PM
protect formats sprice Excel Programming 0 February 4th 04 03:27 AM
put zero value to unprotected cells GUS Excel Programming 2 September 14th 03 10:54 PM


All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"