K
KirstyW
I have written some code in Excel that runs a database query, updates some
sheets and charts based on that query.
I call the code from a control button that first unprotects the worksheets
and charts, calls the above macro and then reprotects the worksheets and
charts.
However, as the code copmpletes, I get an error: "The cell or chart you are
trying to change is protected and therefore read-only"
I know that it is happening as the last step as I have put message boxes
throughout the code to find the point of error: it doesn't happen if you run
it from the vba window.
I have tried using the userinterfaceonly option on the protect method, but I
am running Excel 2003 SP3 and it doesn't seem to recognise it.
I have even tried making the final step of the macro select a cell that I
have deliberately unprotected, but it doesn't work.
Could the problem be that I am calling the code from a control button? I've
used this before and never experienced the problem.
It's driving me mad, can anyone advise?
sheets and charts based on that query.
I call the code from a control button that first unprotects the worksheets
and charts, calls the above macro and then reprotects the worksheets and
charts.
However, as the code copmpletes, I get an error: "The cell or chart you are
trying to change is protected and therefore read-only"
I know that it is happening as the last step as I have put message boxes
throughout the code to find the point of error: it doesn't happen if you run
it from the vba window.
I have tried using the userinterfaceonly option on the protect method, but I
am running Excel 2003 SP3 and it doesn't seem to recognise it.
I have even tried making the final step of the macro select a cell that I
have deliberately unprotected, but it doesn't work.
Could the problem be that I am calling the code from a control button? I've
used this before and never experienced the problem.
It's driving me mad, can anyone advise?