Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi.
Excel 2003. I'm seeing some buggy results. Trying to create form where people cannot change data after they have entered it. I also have comment boxes with pictures inside. These comment boxes I need to have locked down also so that people cannot move the pictures around. 1. Starting with new workbook I unlocked all cells under format cells, protection. 2. I started with unprotected workbook and sheet. 3. I then added a comment box. 4. I then entered the following code in a module. Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Protect Contents:=False Target.Locked = True ActiveSheet.Protect Contents:=True End Sub 5. It allowed me to enter into cells, but I could not make changes afterward. Then: I wanted the boss to be able to make changes in cells if necessary, so I created a macro in excel. I first placed the cursor in the cell I wanted to change then the macro used the mouse to go to tools, protection, and unprotect sheet. Then: The boss would have to re-protect sheet to not allow employees to make changes again. So I created another macro with the mouse going to tools, protection, unprotect sheet then back to tools, protection, protect sheet. This worked except there are always a few cells which will not allow people to type into them even though they were blank. So this is my real concern. Even after the sheet should allow typing it does not. This only occurs, as I said, in only about 2% of the cells. I have a hunch that there is a conflict between the code I have entered and the macros I am trying to run. Either that or I do not truly understand protect and unprotect sheets. Can someone help? -- vze2mss6 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi.
don't bother I figured it out. Thanks so much. -- vze2mss6 "joesf16" wrote: Hi. Excel 2003. I'm seeing some buggy results. Trying to create form where people cannot change data after they have entered it. I also have comment boxes with pictures inside. These comment boxes I need to have locked down also so that people cannot move the pictures around. 1. Starting with new workbook I unlocked all cells under format cells, protection. 2. I started with unprotected workbook and sheet. 3. I then added a comment box. 4. I then entered the following code in a module. Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Protect Contents:=False Target.Locked = True ActiveSheet.Protect Contents:=True End Sub 5. It allowed me to enter into cells, but I could not make changes afterward. Then: I wanted the boss to be able to make changes in cells if necessary, so I created a macro in excel. I first placed the cursor in the cell I wanted to change then the macro used the mouse to go to tools, protection, and unprotect sheet. Then: The boss would have to re-protect sheet to not allow employees to make changes again. So I created another macro with the mouse going to tools, protection, unprotect sheet then back to tools, protection, protect sheet. This worked except there are always a few cells which will not allow people to type into them even though they were blank. So this is my real concern. Even after the sheet should allow typing it does not. This only occurs, as I said, in only about 2% of the cells. I have a hunch that there is a conflict between the code I have entered and the macros I am trying to run. Either that or I do not truly understand protect and unprotect sheets. Can someone help? -- vze2mss6 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking workbooks unpredictable | New Users to Excel | |||
hyperlink unpredictable | New Users to Excel | |||
cell format unpredictable | Excel Discussion (Misc queries) | |||
unpredictable combobox behavior | Excel Programming | |||
WorkbookOpen event unpredictable | Excel Programming |