I work for a communications company and I am trying to run code on an Excel document that has compiled data about trouble reports on products.
The macros I want to run will generate a risk spider chart for each data set when you click across the columns (months).
The macro I have works in the first worksheet but I can't get it to work in the second worksheet when it is essentially the same data.
I would appreciate any help I can get!!
This is the code I have:
Private Sub Worksheet_Calculate()
Call UpdateTotalRatings
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$14" Then
Call UpdateTotalRatings
End If
End Sub
Private Sub UpdateTotalRatings()
Dim Cell As Range
Dim LastCol As String
Application.ScreenUpdating = False
' Ensure number of colours is valid (must be 3 or 6).
If ActiveSheet.Range("B14").Value <> 3 And _
ActiveSheet.Range("B14").Value <> 6 Then
ActiveSheet.Range("B14").Value = 3
End If
' Determine right-most column.
LastCol = Mid(ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Address, 2, 1)
For Each Cell In Range("B13:" & LastCol & "13")
If IsNumeric(Cell.Value) Then
Cell.Interior.Color = ThisWorkbook.GetColour(Cell.Value, _
ActiveSheet.Range("B14").Value)
End If
Next
Application.ScreenUpdating = True
End Sub