Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've been able to created the following VB code, but it takes almost 30 seconds or more to run when the worksheet is activated. I need to know if there is a better way or place to run the code? It would be great if I could get it to run whenever a cell value is changed to Red, Blue, Green, or Amber. I want to use this in a spreadsheet for project milestones ranked as RAG or Blue that are imported from a MS Project Plan file. I've tried to use the same code with another module, Private Sub Worksheet_Calculate(), but it still takes to long to run. What is the fastest way that I can make this code run?
Private Sub Worksheet_Activate() Dim oCell As Range For Each oCell In Range("N17:N151") Select Case oCell.Value Case "Red" oCell.Interior.ColorIndex = 3 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Blue" oCell.Interior.ColorIndex = 5 oCell.Font.ColorIndex = 2 oCell.Font.Bold = True Case "Green" oCell.Interior.ColorIndex = 4 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Amber" oCell.Interior.ColorIndex = 6 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Complete" oCell.Interior.ColorIndex = 1 oCell.Font.ColorIndex = 2 oCell.Font.Bold = True End Select Next oCell For Each oCell In Range("BF261:BF276") Select Case oCell.Value Case "Red" oCell.Interior.ColorIndex = 3 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Blue" oCell.Interior.ColorIndex = 5 oCell.Font.ColorIndex = 2 oCell.Font.Bold = True Case "Green" oCell.Interior.ColorIndex = 4 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Amber" oCell.Interior.ColorIndex = 6 oCell.Font.ColorIndex = 1 oCell.Font.Bold = True Case "Complete" oCell.Interior.ColorIndex = 1 oCell.Font.ColorIndex = 2 oCell.Font.Bold = True End Select Next oCell End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditonal formatting | Excel Worksheet Functions | |||
Conditonal Formatting | Excel Worksheet Functions | |||
conditonal formatting in VB | Excel Worksheet Functions | |||
Conditonal formatting | Excel Discussion (Misc queries) | |||
Conditonal Formatting | Excel Discussion (Misc queries) |