View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Isis[_2_] Isis[_2_] is offline
external usenet poster
 
Posts: 51
Default Non existent code reference problem

"JLGWhiz" wrote in
:

I do not believe this site allows an entire workbook to be posted.
You would have to save the workbook to a sharepoint sever and then
reference the file in a post on this site. But you should be able to
open the VBE and copy the portion of the macro that you are having
trouble with, and then copy and paste that to this this site. Perhaps
you are not familiar with how that works.



"Isis" wrote in message
...
"Per Jessen" wrote in
:

Hi

As always post the code for comments.

Well, as the code run when the sheet is unprotected, I guess that
your code is trying to trying to change one or more cells in the
protected sheet, which it can not.

The solution is to unprotect the sheet by code, then change cells
and protect it again

sub MyMacro
Worksheets("Sheet1").unprotect Password:="JustMe"

'Your Code

Worksheets("Sheet1").Protect Password:="JustMe")
End Sun

Regards,
Per

"Isis" skrev i meddelelsen
...
I have a sheet that seems to get 'stuck' calling a block of non
existent code - it happens after I clear the sheet then click any
of a number of cells.

It has something to do with protection as it does not happen if I
unprotect
the sheet - obviously noone is going to be able to pinpoint this
from a short description !

How can I find the reference to the the non existent code block in
my code - I have done a 'find' within the code but I am not seeing
it ?

Any other ideas would be most welcome.

Thanks



Per, thanks very much for the reply - I don't think I can post the
code, there is a lot of it, but I could post the entire workbook if
that is allowed ?

I realised that the problem is the locked/unlocked status of the
cells, but the block of code being called does not exist as far as I
can tell - the name that comes up does not exist that to to say.

Anyhow, if it's ok to post the workbook I will ? Should I zip it
beforehand ?

Thanks




I stupidly forgot to say that the error can be 'reset' by turning off
protection for the first sheet.

It happens if you use the buttons top left in the order;

'Rota' then 'Get Staff' with the sheet protected.

Thanks