Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default '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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default '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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
Macro that runs when a cell is selected Daniel Bonallack Excel Discussion (Misc queries) 3 October 6th 08 07:21 PM
macro runs if I Clear a cell Tom Ogilvy Excel Programming 1 May 20th 05 03:20 PM
macro runs if I Clear a cell Nimzow Excel Programming 0 May 14th 05 10:15 PM
show comments when cell is highlighted Vs when cursor runs over? don Excel Discussion (Misc queries) 0 April 30th 05 10:22 AM


All times are GMT +1. The time now is 05:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"