ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Options in Cell (https://www.excelbanter.com/excel-programming/308203-options-cell.html)

Jon M.[_2_]

Options in Cell
 
Is there a way to create;

A1=If(b10,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.


Todq

Options in Cell
 
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
-----Original Message-----
Is there a way to create;

A1=If(b10,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.

.


JE McGimpsey

Options in Cell
 
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


In article ,
"Jon M." wrote:

Is there a way to create;

A1=If(b10,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.



All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com