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: 61
Default Lock Cells based on Data in another cell

I have a userform that opens in Sheet1 if any cell between B4 and B1000 is
selected. ComboBox1 has a selection of Mech, Elect or Mech & Elect to select
from. If Mech is chosen I would like to clear the contents of the selected
cell with an offset by 10 to clear and lock.
I have found this code that I am trying to manipulate to suit but struggling
with the activeCell part of the code.
In the code below I would like to change the reference to b1 to
ActiveCell.Offset(0, 4) and reference to B10 to ActiveCell.Offset(0, 14).
Thus if the ActiveCell offset by 4 = Mech, clear the contents of offset cell
14 and lock it.

Private Sub Worksheet_Change(ByVal Target As Range)
If [B1] = "Mech" Then
ActiveSheet.Unprotect
[D10].Locked = False
[D10].Interior.ColorIndex = 34
[D10].ClearContents
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
[D10].Locked = True
[D10].Interior.ColorIndex = 0
ActiveSheet.Protect
End If
End Sub

Any Help would be appreciated.




 
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
How to Lock cells and have them be unlocked based on a cell being hak0828 Excel Programming 1 August 19th 08 04:29 PM
lock cells based on interior color MIke Excel Discussion (Misc queries) 4 December 27th 07 08:59 PM
lock cells based on formula MIke Excel Programming 4 November 15th 07 07:31 PM
lock cells based on formula result MIke Excel Discussion (Misc queries) 1 October 26th 07 03:24 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


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