LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Worksheet_Change vs Worksheet_Calculate

Hi below is my code that is working fine if I type values into columns D or E.
As you can see I have a number of different values to evaluate (more than
conditional formating would allow argghh) and based on the letter, change the
background color. This code resides in my Summary.xls

Now what I really want is to link the values in Summary Column D and E to a
Detail.xls So that for example Summary!D1 = Details!Q23.

If I have both workbooks open, and I make changes to Detail!Q23 the value
of Summary!D1 changes but the background color does not change.

As I read through various posts I understand that if a cell is a formula
then the Worksheet_Change does not recognize it as a change and that
Worksheet_calculate could be used. I'm having trouble understanding the
posts as to how to update my routine to trigger the evaluation using
calculate instead of Change.

Any help would be greatly appreciate.
Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("D:E")) Is Nothing Then
If Target.Value = "G" Then
On Error Resume Next
Application.EnableEvents = False
Target.Interior.ColorIndex = 4
Application.EnableEvents = True
On Error GoTo 0
Else
If Target.Value = "R" Then
On Error Resume Next
Application.EnableEvents = False
Target.Interior.ColorIndex = 3
Application.EnableEvents = True
On Error GoTo 0
Else
If Target.Value = "Y" Then
On Error Resume Next
Application.EnableEvents = False
Target.Interior.ColorIndex = 6
Application.EnableEvents = True
On Error GoTo 0
Else
If Target.Value = "B" Then
On Error Resume Next
Application.EnableEvents = False
Target.Interior.ColorIndex = 5
Application.EnableEvents = True
On Error GoTo 0
Else
If Target.Value = "Gr" Then
On Error Resume Next
Application.EnableEvents = False
Target.Interior.ColorIndex = 15
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End If
End If
End If
End If
End Sub

 
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
Re : Excel Worksheet_Calculate() & Worksheet_Change() [email protected] Excel Programming 0 March 3rd 08 09:31 AM
Worksheet_Calculate or Worksheet_Change? Aria Weston Excel Programming 6 February 6th 07 11:29 PM
Nesting worksheet_Calculate inside worksheet_CHANGE Justin Luyt Excel Programming 5 September 1st 06 02:40 AM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM


All times are GMT +1. The time now is 08:23 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"