Options in Cell

  • Thread starter Thread starter Jon M.
  • Start date Start date
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.
 
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
 
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
 

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

Back
Top