Getting a cell to default


Posted by Clay on January 15, 2001 3:39 PM

How do you get a cell to default to something even if the contents has been deleted?
Also how do you get a letter in one cell (y) if a number (0) is typed in a different cell?

Thanks



Posted by Dave Hawley on January 17, 2001 3:36 AM

Hi Clay

The best way for a cell to stay as a certain value is to use sheet protection with any cells you dont want protected Unlocked; Format>Cells>Protection and Uncheck "Locked"


....Or select you cell with the default value and go to Data>Validation>Custom and type in: =""
then click OK. this wont prevent pasting over though.

...Or Right click on your sheet name tab, select "
View Code" and paste this over the top of what you see:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next
Application.EnableEvents = False
If Target.Address = "$A$1" Then Target = "Hello"
Application.EnableEvents = True
End Sub

Change the address and text to suit and push Alt+Q.

For you second Q try:

=IF(A1=0,"Y","")


Hope this helps

  • OzGrid Business Applications