Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Cell is protected' after VBA runs
Hey everyone,
I have a set of code that runs on the double-click event on a worksheet, to display a user form to assist the user with entering data into the worksheet. The user form does some data validation and then writes the values entered in the form into the worksheet via VBA code. The VBA code Unprotects the sheet, and re-protects before and after entering the data. The ActiveSheet.Protect command is the very last line of code in the subroutine before End Sub. One user (and only one) of the sheet is getting the standard Microsoft Excel error "The cell or chart you are trying to change is protected and therefore read-only." after the code runs. This is despite the fact that the code has already written all values to the sheet, and has re-protected as it's last action before End Sub. The user is not triggering any other events which would account for this error, and I don't know why Excel is giving the error, nor can i work out what it is that is trying to change the data in the worksheet. I have tried it on their computer, stepping through my code in break mode, and the error only comes up after the VBA has run and reached End Sub. There are no events triggered by the user other than the initial double-click which starts the code, and no other macros/code/events which are triggered in any way by the user or my code. Has anyone experienced this, and knows how to get around it? Thanks, Wayne |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Cell is protected' after VBA runs
D'oh!
I found the problem, sorry. The user had "Edit directly in cell" enabled in their Options. As my code was before_DoubleClick, Excel was trying to allow editing in the cell after the code had run. I just needed to put in a Cancel = True. Now why didn't I think of that in the first place?!? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Macro that runs when a cell is selected | Excel Discussion (Misc queries) | |||
macro runs if I Clear a cell | Excel Programming | |||
macro runs if I Clear a cell | Excel Programming | |||
show comments when cell is highlighted Vs when cursor runs over? | Excel Discussion (Misc queries) |