Protect - Unprotect code location
Hi
The code that you posted can not prevent the sheet from beeing protected.
But maybe this UDF is called from an event code in the sheet module or in
ThisWorkbook module ?
My guess is that you have some event code which unprotect the sheet but
never protect it again.
//Per
"usmc-r70" skrev i meddelelsen
...
I removed a specific module and its code: i.e. the following:
Function HasFormula(c As Range) As Boolean
HasFormula = c.HasFormula
End Function
And the aforementioned code works, do you know why?
"Per Jessen" wrote:
Hi
It worked fine for me in both Excel 2000 and Excel 2007.
You could try to step through the code with F8 and check if all
statements
are executed.
Regards,
Per
"usmc-r70" skrev i meddelelsen
...
Not sure if it makes a difference, I am using Office 2007.
"JLGWhiz" wrote:
It worked fine for me the way it is.
"usmc-r70" wrote in message
...
I have the following code that works except for the
ActiveSheet.Unprotect
and
ActiveSheet.Protect (no password to be used), I suspect that I do
not
have
it
in the proper arrangement / location. Can someone help?
Option Explicit
Sub RANKING_SORT()
ActiveSheet.Unprotect
Dim source As Range
With ActiveSheet
Set source = .Range(.Range("A11"),
.Range("AR11").End(xlDown))
End With
source.Sort source.Range("V11"), xlAscending
ActiveSheet.Protect
End Sub
|