ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can a Formula in Cell X modify Cell Y? (https://www.excelbanter.com/excel-discussion-misc-queries/12472-can-formula-cell-x-modify-cell-y.html)

alMandragor

Can a Formula in Cell X modify Cell Y?
 
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that possible?

Please note that there is NO Formular in Cell B1, which is the cell to be
modified...

Thanks


Peo Sjoblom

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that

possible?

Please note that there is NO Formular in Cell B1, which is the cell to be
modified...

Thanks




alMandragor

Thank you Peo,

I will try to get some info on VBA (visual basic???)

"Peo Sjoblom" wrote:

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that

possible?

Please note that there is NO Formular in Cell B1, which is the cell to be
modified...

Thanks





Peo Sjoblom

Yes, you can just use a simple even macro like

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 1 Then Range("B1").Value = 5 Else Range("B1").Value =
6
End Sub


right click on the sheet tab in question and paste in the above, press Alt +
Q to close the VB editor
and test it
--

Regards,

Peo Sjoblom

"alMandragor" wrote in message
...
Thank you Peo,

I will try to get some info on VBA (visual basic???)

"Peo Sjoblom" wrote:

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise

B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that

possible?

Please note that there is NO Formular in Cell B1, which is the cell to

be
modified...

Thanks







alMandragor

i will try it out.

once again, thanks a lot...

regards

"Peo Sjoblom" wrote:

Yes, you can just use a simple even macro like

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 1 Then Range("B1").Value = 5 Else Range("B1").Value =
6
End Sub


right click on the sheet tab in question and paste in the above, press Alt +
Q to close the VB editor
and test it
--

Regards,

Peo Sjoblom

"alMandragor" wrote in message
...
Thank you Peo,

I will try to get some info on VBA (visual basic???)

"Peo Sjoblom" wrote:

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise

B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that
possible?

Please note that there is NO Formular in Cell B1, which is the cell to

be
modified...

Thanks








alMandragor

IT WORKED !!!

THANKS!!!!!!!!!!!!!!!!!!!!!!!!

"Peo Sjoblom" wrote:

Yes, you can just use a simple even macro like

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 1 Then Range("B1").Value = 5 Else Range("B1").Value =
6
End Sub


right click on the sheet tab in question and paste in the above, press Alt +
Q to close the VB editor
and test it
--

Regards,

Peo Sjoblom

"alMandragor" wrote in message
...
Thank you Peo,

I will try to get some info on VBA (visual basic???)

"Peo Sjoblom" wrote:

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise

B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that
possible?

Please note that there is NO Formular in Cell B1, which is the cell to

be
modified...

Thanks








Myrna Larson

If you want cell B1 to change when A1 changes, you put the formula in B1. The
formula in A1 cannot directly change B1. It can only return a result to A1. To
accomplish what you want without a formula in B1 would require VBA
programming, which seems to me (without more information about WHY you can't
put a formula in B1) to be silly in this case.


On Thu, 10 Feb 2005 08:41:03 -0800, "alMandragor"
wrote:

Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that possible?

Please note that there is NO Formular in Cell B1, which is the cell to be
modified...

Thanks



Myrna Larson

Yes, it will work, BUT it slows down your worksheet because this sub runs
whenever you change ANY cell on the worksheet.

Please explain WHY you don't want a formula in B1. If you do that, that
formula will recalculate ONLY when A1 changes. It won't recalculate whenever
some other cell on the worksheet changes, as the macro does.

On Thu, 10 Feb 2005 09:33:07 -0800, "alMandragor"
wrote:

IT WORKED !!!

THANKS!!!!!!!!!!!!!!!!!!!!!!!!

"Peo Sjoblom" wrote:

Yes, you can just use a simple even macro like

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 1 Then Range("B1").Value = 5 Else Range("B1").Value

=
6
End Sub


right click on the sheet tab in question and paste in the above, press Alt

+
Q to close the VB editor
and test it
--

Regards,

Peo Sjoblom

"alMandragor" wrote in message
...
Thank you Peo,

I will try to get some info on VBA (visual basic???)

"Peo Sjoblom" wrote:

No, only through VBA

--

Regards,

Peo Sjoblom


"alMandragor" wrote in message
...
Example:

A Formula in Cell A1 should do the following:

If cell A1 equals 1, then cell B1 should have the value 5, otherwise

B1
should be 6.

A condition in cell A1 is changing the value of cell B1... is that
possible?

Please note that there is NO Formular in Cell B1, which is the cell

to
be
modified...

Thanks










All times are GMT +1. The time now is 02:32 PM.

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