default values

  • Thread starter Thread starter Wilfried
  • Start date Start date
W

Wilfried

How can I put in a cell a default or other value, like if B2=5 then value is
"50", but still be able to fill in another value?

Thanks and regards from Aartselaar (Belgium)
Wilfried
 
In order to do this, you'll need to use an event macro (an entry in a
cell overwrites the existing value or function, which can't be recovered
except with Undo):

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

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target.Cells, Range("B2")) Is Nothing Then
With Range("B2")
If IsEmpty(.Value) Then .Value = 50
End With
End If
End Sub
 
Back
Top