Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Lock cell if based on value of corresponding cell

Hi, I was tring to lock cell if value of corresponding cell is error
If value B3:B20 is error lock corresponding cells in ColumnE, F & H


OR
unlock cell if value of corresponding cell is 0

If value B3:B20 is 0 unlock corresponding cells in ColumnE, F & H


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Lock cell if based on value of corresponding cell

Putting this module into the individula sheet in the VBA editor will lock or
unlock the cells everytime the sheet is changed.

Sub Worksheet_Change(ByVal target As Range)

ActiveSheet.Unprotect
For B = 3 To 20
If IsError(Cells(B, 2)) Then
Cells(B, 5).Locked = True
Cells(B, 6).Locked = True
Cells(B, 8).Locked = True
Else
If Cells(B, 2) 0 Then
Cells(B, 5).Locked = False
Cells(B, 6).Locked = False
Cells(B, 5).Locked = False
End If
End If
Next B
ActiveSheet.Protect
End Sub


or you could tie this same routine to a button if you only want to run it on
demand.

--
If this helps, please remember to click yes.


"Kashyap" wrote:

Hi, I was tring to lock cell if value of corresponding cell is error
If value B3:B20 is error lock corresponding cells in ColumnE, F & H


OR
unlock cell if value of corresponding cell is 0

If value B3:B20 is 0 unlock corresponding cells in ColumnE, F & H


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
Lock Cells based on Data in another cell Woodi2 Excel Programming 2 March 13th 09 03:04 PM
lock a cell based on cell value Texins Karate Excel Discussion (Misc queries) 1 December 20th 08 10:05 AM
lock cell based on a condition Amanda Excel Worksheet Functions 22 June 25th 07 07:53 PM
Lock data in a cell a specific cell based on selection on other ce CrimsonPlague29 Excel Worksheet Functions 0 May 10th 06 11:06 AM
How to lock a row in a spreadsheet based on the value in a cell Prasad Excel Worksheet Functions 3 December 16th 05 05:18 PM


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