default value

  • Thread starter Thread starter ant
  • Start date Start date
A

ant

i need one cell to have a default value of "-" at all
times. Expect when a user enters a number. I just need
that cell to hava a value in it at all times.

How can i set the defaut value to "-" even when the
user blanks the cell that s going to be the value

How can i do this
 
Ant,

I would think that the fact that some of the big hitters around here have
answered other posts but not yours means that what you are asking for is not
possible - an empty cell has the value of an empty cell and by definition
cannot have anything else.

Formatting can change how the value in a cell will look but there must be a
value there to start with. As an example, if you format the cell as
Accounting with no symbol and give it a value of zero then it will show the
"-" that you are asking for but with no value in the cell it will show a
blank cell.

Regards

Sandy
 
Can't do this with worksheet functions, but you can use an event macro.
One way:

Put this in the worksheet code module (right-click the worksheet tab and
choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(.Cells, .Range("A1")) Is Nothing Then _
If IsEmpty(.Value) Then _
.Value = "-"
End With
End Sub
 
Back
Top