Can a formula in one cell cause something to be displayed in another cell?

  • Thread starter Thread starter Marvin Hlavac
  • Start date Start date
M

Marvin Hlavac

Is it possible to put an IF formula to A1 which would display "TRUE" in C1
if there is e.g. number 1 in cell B1?
 
Marvin, a formula cannot change another cell, you would need VBA to do that,
but you could put this in C1 =IF(B1=1,"True","")

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 
Marvin, a formula cannot change another cell, you would need VBA to do
that,
but you could put this in C1 =IF(B1=1,"True","")


Hi Paul,

The thing is that I don't want any formula in C1. Would you be able to help
me with VBA on that?
 
Marvin, this should do it

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(1, 2) = 1 Then
Range("C1").Value = "TRUE"
Else
Range("C1").Value = ""
End If
End Sub

To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run.


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 
Thanks Paul,

This looks like it should solve my little problem. Just a last question: in
the part "If Cells(1, 2) = 1 Then" the numbers 1,2 represent cell B1?

--
Regards,
Marvin Hlavac
Toronto, Canada
 
Marvin,

yes, the first number is the row index and the second is the column index
so 1 is the first row and 2 the second column = B1
 
Just a thought
Put "True" in C1 and with conditional format have the font color be
the same as the background color if there is no number in B1.
Ilan
 
Back
Top