Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Auto-update of formula results

Hi All,
I have a code which enters the formula in the different cells based on
the colour index. My problem is the formula results are not updated
automaticaly based on the new colour. If I run the macro again, it is
updated and if I press F2 and Enter, it gets updated. My code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same workbook.

I need to update automatically just like sum or any other formulas.

Can somebody point out my mistakes or any additions to the codde?

Regards,
Shetty
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto-update of formula results

Formulas are updated when Excel does a Calculation. Changing the colorindex
does not cause a calculation. You would need to make your formula volatile

Application.Volatile as the first line after the declaration in the UDF

Then force a calculation when you want the formulas to update.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
om...
Hi All,
I have a code which enters the formula in the different cells based on
the colour index. My problem is the formula results are not updated
automaticaly based on the new colour. If I run the macro again, it is
updated and if I press F2 and Enter, it gets updated. My code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same workbook.

I need to update automatically just like sum or any other formulas.

Can somebody point out my mistakes or any additions to the codde?

Regards,
Shetty



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Auto-update of formula results

Add Application.Volatile to your function...then it will
update every tiem the sheet recalcs

Sub Conditional_Formula_Entry()

With Range(ActiveCell, _
ActiveCell.Offset(0, 1).End(xlDown).Offset(0, -1))

.FormulaR1C1 = "=showrgb(RC[2])"

End With
End Sub

Function showrgb(x)
Application.Volatile
End Function
-----Original Message-----
Hi All,
I have a code which enters the formula in the different

cells based on
the colour index. My problem is the formula results are

not updated
automaticaly based on the new colour. If I run the macro

again, it is
updated and if I press F2 and Enter, it gets updated. My

code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same

workbook.

I need to update automatically just like sum or any

other formulas.

Can somebody point out my mistakes or any additions to

the codde?

Regards,
Shetty
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Auto-update of formula results

Thanks Tom,
I have added application.volatile as you have suggested
and then tried F9 as well as tools/options/calc sheet and
tools/options/calc sheet but it is still showing the same
results. More suggetions please.
Regards,
Shetty

-----Original Message-----
Formulas are updated when Excel does a Calculation.

Changing the colorindex
does not cause a calculation. You would need to make

your formula volatile

Application.Volatile as the first line after the

declaration in the UDF

Then force a calculation when you want the formulas to

update.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
. com...
Hi All,
I have a code which enters the formula in the different

cells based on
the colour index. My problem is the formula results are

not updated
automaticaly based on the new colour. If I run the

macro again, it is
updated and if I press F2 and Enter, it gets updated.

My code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same

workbook.

I need to update automatically just like sum or any

other formulas.

Can somebody point out my mistakes or any additions to

the codde?

Regards,
Shetty



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto-update of formula results

It shows the same result on a recalc, but if you select the cell, do F2 to
edit, then hit enter, it changes?

Setting the function to volatile causes it to be recalced on each
calculation. Beyond that, there are not other options unless you want to
use the Edit=replace functionality to replace the equal sign in the formula
with an equal sign to simulate editing the cell.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
...
Thanks Tom,
I have added application.volatile as you have suggested
and then tried F9 as well as tools/options/calc sheet and
tools/options/calc sheet but it is still showing the same
results. More suggetions please.
Regards,
Shetty

-----Original Message-----
Formulas are updated when Excel does a Calculation.

Changing the colorindex
does not cause a calculation. You would need to make

your formula volatile

Application.Volatile as the first line after the

declaration in the UDF

Then force a calculation when you want the formulas to

update.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
. com...
Hi All,
I have a code which enters the formula in the different

cells based on
the colour index. My problem is the formula results are

not updated
automaticaly based on the new colour. If I run the

macro again, it is
updated and if I press F2 and Enter, it gets updated.

My code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same

workbook.

I need to update automatically just like sum or any

other formulas.

Can somebody point out my mistakes or any additions to

the codde?

Regards,
Shetty



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto-update of formula results

Yes. It changes with select the cell, do F2 to edit, then
hit enter. Since no other option is available , I will
follow the find = and replace all with = to update. Is it
possible with a macro? I will run the macro for with event
that will fir with the change in any cell in column B.

Thanks again.
Shetty


-----Original Message-----
It shows the same result on a recalc, but if you select

the cell, do F2 to
edit, then hit enter, it changes?

Setting the function to volatile causes it to be recalced

on each
calculation. Beyond that, there are not other options

unless you want to
use the Edit=replace functionality to replace the equal

sign in the formula
with an equal sign to simulate editing the cell.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
...
Thanks Tom,
I have added application.volatile as you have suggested
and then tried F9 as well as tools/options/calc sheet

and
tools/options/calc sheet but it is still showing the

same
results. More suggetions please.
Regards,
Shetty

-----Original Message-----
Formulas are updated when Excel does a Calculation.

Changing the colorindex
does not cause a calculation. You would need to make

your formula volatile

Application.Volatile as the first line after the

declaration in the UDF

Then force a calculation when you want the formulas to

update.

--
Regards,
Tom Ogilvy

"Shetty" wrote in message
. com...
Hi All,
I have a code which enters the formula in the

different
cells based on
the colour index. My problem is the formula results

are
not updated
automaticaly based on the new colour. If I run the

macro again, it is
updated and if I press F2 and Enter, it gets updated.

My code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same

workbook.

I need to update automatically just like sum or any

other formulas.

Can somebody point out my mistakes or any additions

to
the codde?

Regards,
Shetty


.



.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Auto-update of formula results

Thanks Patrick.
Now the results are updated every time I press F9. I have added
application.volatile in the function as shown by you.

Tom Ogilvy :
My apology. You also gave me the same solution (adding
application.volatile to UDF) But by mistake I added it to the macro
code. When I saw the code by Patrick, I realise my mistake. Sorry
again and Thanks.

Regards,
Shetty

"Patrick Molloy" wrote in message ...
Add Application.Volatile to your function...then it will
update every tiem the sheet recalcs

Sub Conditional_Formula_Entry()

With Range(ActiveCell, _
ActiveCell.Offset(0, 1).End(xlDown).Offset(0, -1))

.FormulaR1C1 = "=showrgb(RC[2])"

End With
End Sub

Function showrgb(x)
Application.Volatile
End Function
-----Original Message-----
Hi All,
I have a code which enters the formula in the different

cells based on
the colour index. My problem is the formula results are

not updated
automaticaly based on the new colour. If I run the macro

again, it is
updated and if I press F2 and Enter, it gets updated. My

code is as
below.

================
Sub Conditional_Formula_Entry()

Do While IsEmpty(ActiveCell.Offset(0, 1)) = False

ActiveCell.FormulaR1C1 = "=showrgb(RC[2])"

ActiveCell.Offset(1, 0).Select

Loop

End Sub
==================
NOte : ShowRGB is UDF and working fine in the same

workbook.

I need to update automatically just like sum or any

other formulas.

Can somebody point out my mistakes or any additions to

the codde?

Regards,
Shetty
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-update column formula Alex Excel Discussion (Misc queries) 1 February 17th 10 04:51 PM
My cell formula results won't update automatically. Help? Tori Excel Discussion (Misc queries) 1 September 24th 08 11:20 PM
A formula to auto-update a classification ONLY if it goes UP thorshammer Excel Worksheet Functions 3 August 12th 08 03:06 PM
formuls results won't update automatically (auto is turned on) cmoennig Excel Worksheet Functions 0 February 16th 06 12:17 AM
Can I disable auto formula update? jch New Users to Excel 4 August 9th 05 06:31 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"