Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Row B and C both need to be locked to prevent the user from entering data,
however, I have code that puts a formula into these cells when the user enters a date into Cell A. When I lock the cells and protect the sheet, I get an error because the code it trying to add the formula to a locked cell. Is there any way around this? Thanks, Kevin |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I assume your are using the on change event... You need to turn protection
off to make your update. Here is some code for you so use as a guideline. Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ErrorHandler Application.EnableEvents = False If Target.Address = "$A$1" Then ActiveSheet.Unprotect 'Your other code here... ActiveSheet.Protect End If ErrorHandler: Application.EnableEvents = True End Sub HTH "Kevin Baker" wrote: Row B and C both need to be locked to prevent the user from entering data, however, I have code that puts a formula into these cells when the user enters a date into Cell A. When I lock the cells and protect the sheet, I get an error because the code it trying to add the formula to a locked cell. Is there any way around this? Thanks, Kevin |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kevin,
Unprotect the sheet first them protect it again after you code. sheets("test").unportect "Your Password" 'your code sheets("test").protect "Your Password" Regards Neil "Kevin Baker" wrote in message news:3cahe.4827$It1.128@lakeread02... Row B and C both need to be locked to prevent the user from entering data, however, I have code that puts a formula into these cells when the user enters a date into Cell A. When I lock the cells and protect the sheet, I get an error because the code it trying to add the formula to a locked cell. Is there any way around this? Thanks, Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Locked worksheet & hyperlinks (w/ select locked cells unchecked) | Excel Discussion (Misc queries) | |||
paste locked cells and unlocked cells in protected sheet | Excel Worksheet Functions | |||
Put comments on a locked spreadsheet even though cells not locked | Excel Worksheet Functions | |||
Delete specific cells contents in a row with some locked cells in the same row | Excel Programming | |||
I want the macros to be locked up when cells are locked up. | Excel Programming |