Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default protect sheet when cell is not blank

Hello
In VBA - Cell N11 is blank, but whenever Cell N11 is not blank I want to
protect the entire sheet with the word "pass"
thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default protect sheet when cell is not blank

This goes into the worksheet's code module (right-click on the sheet's name
tab and choose View Code from the list, then copy and paste this into the
module presented to you). Naturally cell N11 is going to have to be unlocked
or you won't be able to clear the entry in it once the sheet goes into
protected state:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$N$11" Then
Exit Sub
End If
If IsEmpty(Target) Then
ActiveSheet.Unprotect Password:="PASS"
Else
ActiveSheet.Protect Password:="PASS"
End If
End Sub


"Wanna Learn" wrote:

Hello
In VBA - Cell N11 is blank, but whenever Cell N11 is not blank I want to
protect the entire sheet with the word "pass"
thanks in advance

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 data into next blank cell down in next sheet Nick Wakeham Excel Worksheet Functions 2 July 24th 08 08:07 PM
Using if function to show blank when cell in other sheet is empty Billznik Excel Worksheet Functions 2 August 9th 06 03:46 AM
Protect Workbook Vs Protect Sheet Poor_pakistani New Users to Excel 4 May 25th 06 02:06 PM
Password protect cell ranges NOT sheet Nadia Excel Discussion (Misc queries) 3 December 13th 05 04:57 AM
Protect Cell if value <> 0 OR blank? newbie Excel Worksheet Functions 8 December 13th 04 09:23 AM


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