default values

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
 
J

JE McGimpsey

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top