ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting certain fields in workbook (https://www.excelbanter.com/excel-programming/277831-protecting-certain-fields-workbook.html)

KimberlyC

Protecting certain fields in workbook
 
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



steve

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






All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com