View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default change cell color

Hi Ed,

This code works good, is there anyway to keep the formulas from
showing in the formula bar?


Try something like:

'=============
Public Sub Tester()
Dim SH As Worksheet
Dim rng As Range
Const PWORD As String = "ABC" '<<==== CHANGE

Set SH = ThisWorkbook.Sheets("Sheet1") '<<==== CHANGE

SH.Unprotect Password:=PWORD
On Error Resume Next
Set rng = SH.Cells.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0

If Not rng Is Nothing Then
With rng
.Locked = True
.FormulaHidden = True
End With
End If

SH.Protect Password:=PWORD

End Sub
'<<=============

Incidentally, it is advisable to post separate questions in a new thread.
This is not only to accord with established group etiquette but to
facilitate coherent Google storage and, not least, to maximise your
prospects of receiving viable assistance.


---
Regards,
Norman