View Single Post
 
Old 02-23-2012, 12:49 PM
AHB AHB is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Dec 2011
Posts: 5
AHB is on a distinguished road
Default Cell formating on Protected worksheet

Hi, I'm a novice at VBA.

This is VBA code I'm using to change the formating in 2 cells based on the value in another cell. This code works fine when worksheet is not protected but the text formating and locking don't work when wkst is protected. Not sure what I've done wrong. Any help appreciated.

Private Sub Steam_Option_Change()
'Trigger for locking second press and temp input cells
Application.ScreenUpdating = False
If Range("BC409").Value = True Then
Range("AP33").Select
ActiveCell.FormulaR1C1 = "'-- n/a --"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 16
Selection.Locked = True
Selection.FormulaHidden = False
Range("AP34").Select
ActiveCell.FormulaR1C1 = "'-- n/a --"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 16
Selection.Locked = True
Selection.FormulaHidden = False
ElseIf Range("BC409").Value = False Then
Range("AP33").Select
Selection.ClearContents
Selection.Font.Bold = False
Selection.Font.ColorIndex = 0
Selection.Locked = False
Selection.FormulaHidden = False
Range("AP34").Select
Selection.ClearContents
Selection.Font.Bold = False
Selection.Font.ColorIndex = 0
Selection.Locked = False
Selection.FormulaHidden = False
End If
End Sub
Reply With Quote