Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Forcing Excel to update, or recalculate.

Hi everyone!
I have been looking for a way to force, coerce, beg a worksheet to update,
or maybe the better word is recalculate its cells either by a specific
keystroke, or better yet, when the cell output is changed.
I have been working with bypassing the conditional format limitation, and
have that taken care of. Unfortunately, the cells that have the conditional
format applied reference the calculated values in other cells. I can change
the values in the "other" cells without a problem, but the cells that I need
to change do not update the formatting.
I can select each cell individually, and hit the Enter key, and VIOLA! the
cell format changes, but it will not do it automatically.
I have looked at application.volitile, application.refreshall, but have come
up empty.
Does anyone have any suggestions?

Thanks a bunch!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Forcing Excel to update, or recalculate.

There are worksheet events that are lurking waiting for something to happen.

One of them is the Worksheet_Change event. It's waiting for you to make a
change to any cell(s) via typing.

Another one is the worksheet_Calculate event. It's waiting for the worksheet to
be recalculated.

You can tie into each of these--for instance if you had a range of cells to
check each time the worksheet recalculated:

You can right click on the worksheet tab that should have this behavior and
select view code.

Then paste this into the code window:

Option Explicit
Private Sub Worksheet_Calculate()

Dim myRngToCheck As Range
Dim myCell As Range
Dim myColorIndex As Long

Set myRngToCheck = Me.Range("a1,b9,c13:c15")

For Each myCell In myRngToCheck.Cells
Select Case myCell.Value
Case Is = 1: myColorIndex = 3
Case Is = 3: myColorIndex = 8
Case Is = 5: myColorIndex = 10
Case Else
myColorIndex = xlNone
End Select
myCell.Interior.ColorIndex = myColorIndex
Next myCell

End Sub

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


Fleone wrote:

Hi everyone!
I have been looking for a way to force, coerce, beg a worksheet to update,
or maybe the better word is recalculate its cells either by a specific
keystroke, or better yet, when the cell output is changed.
I have been working with bypassing the conditional format limitation, and
have that taken care of. Unfortunately, the cells that have the conditional
format applied reference the calculated values in other cells. I can change
the values in the "other" cells without a problem, but the cells that I need
to change do not update the formatting.
I can select each cell individually, and hit the Enter key, and VIOLA! the
cell format changes, but it will not do it automatically.
I have looked at application.volitile, application.refreshall, but have come
up empty.
Does anyone have any suggestions?

Thanks a bunch!


--

Dave Peterson
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
Forcing to recalculate Michael.Tarnowski Excel Worksheet Functions 7 February 11th 09 02:49 PM
vlookup doesn't update / recalculate kfell Excel Discussion (Misc queries) 7 March 23rd 07 04:13 PM
forcing excel to update the Cell Link when copying Combo Boxes Baraki0568 Excel Worksheet Functions 0 September 13th 06 04:16 AM
Forcing users to update spreadsheets DKerr Excel Discussion (Misc queries) 2 July 27th 06 12:55 PM
"Application.Calculate" does not always update/recalculate the for John K Excel Programming 1 January 20th 05 06:27 PM


All times are GMT +1. The time now is 05:13 AM.

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

About Us

"It's about Microsoft Excel"