LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with locking Cells


Hi

I am trying to lock and unlock cells in an Excel 97 App via VB code. I
have the following function

Private Sub Workbook_Open()

ActiveSheet.Unprotect password:=Worksheets("sheet2").Range("PWD")

Worksheets("sheet1").Range("A1:BH22").Locked = True
Range("CompletedBy").Locked = False

ActiveSheet.Protect password:=Worksheets("Sheet2").Range("PWD"),
userinterfaceonly:=True
End Sub

Setting the Locked property works fine using a reference like "A1:B
H22" but fails when using a named range.

Does anyone have any idea why I cannot use a named range in this code.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
 
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
Locking Cells HS[_2_] New Users to Excel 2 May 18th 09 09:43 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking Cells chefmike Excel Discussion (Misc queries) 6 March 15th 06 04:50 PM
Locking Cells rob8278 Excel Worksheet Functions 0 May 12th 05 07:56 PM
Locking certain cells Marvin Excel Worksheet Functions 1 December 7th 04 07:13 PM


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