Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Locked sheet

Anyone know why a locked sheet would not allow the following VB to run -
I get an error at the Selection.clear contents point (although the sheet
is locked only formulae are locked, and they are not near these cells"
Point of the formulae to is to delte (formats and contents of 24c5 to
28c6

Sheets("Review Plan").Select
Application.Goto Reference:="R24C5:R28C6"
Application.CutCopyMode = False
Selection.ClearContents
Selection.ClearFormats

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Locked sheet


Darin...

ClearFormats or Clear will set the locked property for a cell
to the 'default' from the style 'Normal' .

In most cases Normal style will have Locked set to TRUE.
.... thus your cells are locked again.


To avoid problems with automating protected sheets,
use the UserInterfaceOnly option of the Protect Method.

Be sure to read the remarks section in VBA help. You'll need to
Unprotect/Reprotect your worksheets on file open as that option is not
saved.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Darin Kramer wrote :

Anyone know why a locked sheet would not allow the following VB to
run - I get an error at the Selection.clear contents point (although
the sheet is locked only formulae are locked, and they are not near
these cells" Point of the formulae to is to delte (formats and
contents of 24c5 to 28c6

Sheets("Review Plan").Select
Application.Goto Reference:="R24C5:R28C6"
Application.CutCopyMode = False
Selection.ClearContents
Selection.ClearFormats

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Locked sheet

Thanks for the help... just one question...

Is the UserInterfaceONly option an add in...? where can I find it..?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Locked sheet

Look in Excel VBA help under the Protect method. It is one of the
arguments.

--
Regards,
Tom Ogilvy

"Darin Kramer" wrote in message
...
Thanks for the help... just one question...

Is the UserInterfaceONly option an add in...? where can I find it..?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Locked sheet

I know its been a while... but when trying this I am unable to get it to
work.

Just inserted a basic protection function (see below)

Im still having the same problem ie cells that were not locked, become
locked when I run a macro Say range a10:c50.

I thought inserting the UserInteraceONly option would resolve this?

Help...



Sub ProtectSheet()

ActiveSheet.Protect , UserInterfaceOnly:=True,
AllowFormattingCells:=True

End Sub







*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Inserting a row into a locked sheet BillS512 Excel Discussion (Misc queries) 0 December 17th 08 11:33 PM
locked out of my sheet for read only wwoody Excel Worksheet Functions 1 March 1st 06 01:52 AM
locked up spread sheet nellie4020 Excel Discussion (Misc queries) 1 April 15th 05 12:30 PM
Sheet locked by owner Duane Excel Programming 1 November 21st 03 03:49 PM
Locked Sheet libby Excel Programming 0 November 7th 03 06:14 PM


All times are GMT +1. The time now is 04:01 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"