Options in Cell

J

Jon M.

Is there a way to create;

A1=If(b1>0,b1, (otherwise 0 or user input)

so if b1=1 then a1=1, if b1=0 then a1 would = 0 or else a
value inputed by the user.
 
T

Todq

If Range("B1").Value > 0 Then
Range("A1").Value = Range("B1").Value
Else
Range("A1").Value = InputBox("Enter a value for Cell
A1.", , 0)
End If

Tod
 
J

JE McGimpsey

Cells can't contain both a formula and user input.

You could simulate what you're after with an event macro. Put this in
the worksheet code module:

Private Sub Worksheet_Calculate()
With Range("B1")
If .Value > 0 Then
Range("A1").Value = .Value
ElseIf .Value = 0 Then
With Range("A1")
If IsEmpty(.Value) Then .Value = 0
End With
Else
'?????
End If
End With
End Sub
 
Top