LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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






 
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
Code to protect/unprotect a sheet using a macro with password FredH Excel Discussion (Misc queries) 5 October 23rd 07 04:49 PM
Protect/UnProtect Project (code) via VBA? brucemc[_24_] Excel Programming 1 July 5th 06 05:21 AM
Generic protect/unprotect code through buttons and code? StargateFanFromWork[_3_] Excel Programming 4 December 31st 05 12:10 AM
Please help!!! Using code to password-protect and unprotect... Hawk Excel Programming 6 July 9th 05 10:48 PM
VBA code - protect and unprotect a sheet Jeff Excel Programming 2 December 2nd 03 11:44 PM


All times are GMT +1. The time now is 07:53 AM.

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

About Us

"It's about Microsoft Excel"