View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Protecting certain fields in workbook

Kimberly,

Move the code to the Thisworkbook module and put it in the workbook open
event

Dim x as Integer
For x = 1 to Activeworkbook.Worksheets.count
Sheets(x).EnableSelection = xlUnlockedCells
Next

--
sb
"KimberlyC" wrote in message
...
Hi,
I have several worksheets in a workbook. These worksheets have borders

that
I have protected the cell to keeps them for being removed when the
worksheets are protected.
However, these borders are being copied and pasted to other cells in the
worksheets that are not protected.
I posted a question on how to keep users from being able to select those
cells that have borders in it, and this was the solution that someone from
this newsgroup gave me:

Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.EnableSelection = xlUnlockedCells

End Sub

This is working great! But, I would like to not have any code in the
workbook... expect in the Thisworkbook module; and this code only works if

I
have it in each worksheets's module.
So, my question is, is there a way to make this code or some other code

work
from an addin file or in ThisWorkbook module of my current workbook?

Thanks in advance for you help!!
Kimberly