Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
abcdexcel
 
Posts: n/a
Default Validation & Protection


Hi

I have a cell in which drop down list box is applied. Depending upon
the data in that cell, code needed to lock (protect / unprotect) the
adjacent cell.

Thnks & Regrds,
New Excel User.


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=497330

  #2   Report Post  
Posted to microsoft.public.excel.misc
DataMouse.biz
 
Posts: n/a
Default Validation & Protection

Happy new year.

If you need an action to occur on a condition, you'll need an IF statement.
Because you want to change a screen option, you'll need some code.

So what we do is use an event to check teh value and take action

Something like:

If Range("A1") = "yourvalue" Then
'unprotect/unlock cell
Range("A1").Select
ActiveSheet.Unprotect
Selection.Locked = False
Else
'lock and protect
Range("A1").Select
ActiveSheet.Unprotect
Selection.Locked = False
End if

'reprotect sheet
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

idea...?


Danny


"abcdexcel" wrote:


Hi

I have a cell in which drop down list box is applied. Depending upon
the data in that cell, code needed to lock (protect / unprotect) the
adjacent cell.

Thnks & Regrds,
New Excel User.


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=497330


  #3   Report Post  
Posted to microsoft.public.excel.misc
abcdexcel
 
Posts: n/a
Default Validation & Protection


Wish U the same.

Thanks for replying. That will certaining help me.

But I need a code for the entire column / row. A code with a loop or
something like it.

Thanks & Regards,
Aamir


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=497330

  #4   Report Post  
Posted to microsoft.public.excel.misc
DataMouse.biz
 
Posts: n/a
Default Validation & Protection

If you know the range, you can specify in the example given
Range("start","end")

If you want to loop through cells, that can be done with a FOR NEXT loop -
but I'd need to know which cells you want to protect...
Then you call functions to protect ot unprotect:

Function UnprotectCell()
'unprotect/unlock cell
ActiveCell.Select
ActiveSheet.Unprotect
Selection.Locked = False
End Function

Function ProtectCell()
'unprotect/unlock cell
ActiveCell.Select
ActiveSheet.Unprotect
Selection.Locked = True
End Function





"abcdexcel" wrote:


Wish U the same.

Thanks for replying. That will certaining help me.

But I need a code for the entire column / row. A code with a loop or
something like it.

Thanks & Regards,
Aamir


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=497330


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
Validation & Protection abcdexcel Excel Discussion (Misc queries) 0 December 31st 05 07:21 AM
Copy workbook- Validation function sjs Excel Worksheet Functions 3 December 28th 05 03:00 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM
Data validation, cell protection or other method? KG Excel Discussion (Misc queries) 5 June 17th 05 05:22 AM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM


All times are GMT +1. The time now is 02:32 PM.

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"