Cell protection

G

gav meredith

hi,

Is it possible within an excel sheet, to use an 'if' statement to protect a
cell?? ie if B9>1, "inc"....but i dont want the user to be able to alter
that cell because if they delete it, they will delete the formula.

Any suggestions are appreciated.Thanks!!!!!
 
B

Bob Umlas

You can prevent the user from selecting the cell in the first place.
Right-click the sheet tab, select View Code, enter this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$9" Then '<===change this if you wish
Range("A1").Select
End If
End Sub

Bob Umlas
Excel MVP
 
G

gav meredith

Thank you Bob. That is not quite what im after but very handy to know and i
will use it actually. To clarify, the user has 2 options......1 is to select
an item as an inclusion and if they do so, the price is shown (in lets say
d9) and the corresponding cell (e9) should show this by stating "inc" If it
is not an inclusion they should be able to select (e9) and insert a 1 to
show it as an option. Summarised, if d9>1, then d10 should show "inc". Cant
use an if statement though because they might delete the formula.......any
other codes???

cheers!!!
 
Top