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: 29
Default Worksheet_Calculate with no effect

Hi,

i have such a code:

Private Sub Worksheet_Calculate()
Dim rang As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each rang In Range("P6:S6")

If rang.Value = "-" Then
rang.Interior.ColorIndex = 2
rang.Font.ColorIndex = 2
ElseIf rang = -1 And rang < -0.8 Then
rang.Interior.ColorIndex = 11
ElseIf rang = -0.8 And rang < -0.6 Then
rang.Interior.ColorIndex = 5
ElseIf rang = -0.6 And rang < -0.4 Then
rang.Interior.ColorIndex = 41
ElseIf rang = -0.4 And rang < -0.2 Then
rang.Interior.ColorIndex = 33
ElseIf rang = -0.2 And rang < 0 Then
rang.Interior.ColorIndex = 34
ElseIf rang = 0 And rang < 0.2 Then
rang.Interior.ColorIndex = 40
ElseIf rang = 0.2 And rang < 0.4 Then
rang.Interior.ColorIndex = 44
ElseIf rang = 0.4 And rang < 0.6 Then
rang.Interior.ColorIndex = 45
ElseIf rang = 0.6 And rang < 0.8 Then
rang.Interior.ColorIndex = 46
ElseIf rang = 0.8 And rang < 1 Then
rang.Interior.ColorIndex = 53
End If

If rang = -1 And rang < -0.6 Then
rang.Font.ColorIndex = 2
ElseIf rang = -0.6 And rang < 0.6 Then
rang.Font.ColorIndex = 1
ElseIf rang = 0.6 And rang < 1 Then
rang.Font.ColorIndex = 2
End If

Next

For Each rang In Range("P10:S10")

If rang.Value = "-" Then
rang.Interior.ColorIndex = 2
rang.Font.ColorIndex = 2
ElseIf rang = -1 And rang < -0.8 Then
rang.Interior.ColorIndex = 11
ElseIf rang = -0.8 And rang < -0.6 Then
rang.Interior.ColorIndex = 5
ElseIf rang = -0.6 And rang < -0.4 Then
rang.Interior.ColorIndex = 41
ElseIf rang = -0.4 And rang < -0.2 Then
rang.Interior.ColorIndex = 33
ElseIf rang = -0.2 And rang < 0 Then
rang.Interior.ColorIndex = 34
ElseIf rang = 0 And rang < 0.2 Then
rang.Interior.ColorIndex = 40
ElseIf rang = 0.2 And rang < 0.4 Then
rang.Interior.ColorIndex = 44
ElseIf rang = 0.4 And rang < 0.6 Then
rang.Interior.ColorIndex = 45
ElseIf rang = 0.6 And rang < 0.8 Then
rang.Interior.ColorIndex = 46
ElseIf rang = 0.8 And rang < 1 Then
rang.Interior.ColorIndex = 53
End If

If rang = -1 And rang < -0.6 Then
rang.Font.ColorIndex = 2
ElseIf rang = -0.6 And rang < 0.6 Then
rang.Font.ColorIndex = 1
ElseIf rang = 0.6 And rang < 1 Then
rang.Font.ColorIndex = 2
End If

Next

Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

unfortunatelly, cells in ranges P6:S6 and P10:S10 are not being coloured and
i have no idea why

how can i check this

 
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
Worksheet_Calculate tmkkoservo Excel Programming 1 August 20th 07 04:08 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 2 January 26th 07 01:16 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 0 January 26th 07 08:14 AM
Worksheet_calculate() Alex Excel Programming 1 August 30th 05 10:09 PM
worksheet_calculate **help** tommyboy Excel Programming 2 June 29th 04 08:33 AM


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