Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing Cells depending on data entered in other cells
i'm trying to create a spreadsheet where depending on what data is entered in one cell thats how the other cells get changed, that is, gray out and disabled. i have the following vbscript coded so far but this could be totally incorrect, it's just not working......any help will be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range) If ActiveCell.Column = 5 And ActiveCell.Row = 7 Then If Target.Value = "X" Then ActiveSheet.Unprotect Password:="MyPassword" With ActiveCell.Offset(0, 5) .ClearContents .Interior.Color = RGB(192, 192, 192) .Locked = True End With ActiveSheet.Protect Password:="MyPassword" Else If Target.Value = "" Then ActiveSheet.Unprotect Password:="MyPassword" With ActiveCell.Offset(0, 5) .ClearContents .Interior.Color = RGB(255, 255, 255) .Locked = False End With ActiveSheet.Protect Password:="MyPassword" End If End If ElseIf ActiveCell.Column = 7 And ActiveCell.Row = 7 Then If Target.Value = "X" Then ActiveSheet.Unprotect Password:="MyPassword" With ActiveCell.Offset(0, 3) .ClearContents .Interior.Color = RGB(192, 192, 192) .Locked = True End With ActiveSheet.Protect Password:="MyPassword" Else If Target.Value = "" Then ActiveSheet.Unprotect Password:="MyPassword" With ActiveCell.Offset(0, 3) .ClearContents .Interior.Color = RGB(255, 255, 255) .Locked = False End With ActiveSheet.Protect Password:="MyPassword" End If End If End If End Sub Thanking you in advance, Farida |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
changing the colour of cells depending on the content. | Excel Discussion (Misc queries) | |||
Changing cell colour depending on another cells value... | Excel Discussion (Misc queries) | |||
Colouring a row depending on data entered in a column | Excel Worksheet Functions | |||
Protect data in cells after entered | Excel Discussion (Misc queries) | |||
How do I automatically shade cells depending on data entered? | Excel Worksheet Functions |