M
Mike K
Oh wise ones,
I borrowed the HappyFace Gauge from one of
the experts website. For those unfamiliar, the face will
go from frown to smile as a cell number changes from 0-
100. The gauge works fine by manually entering a number
from 0-100. The problem arises when I use a reference to
update the cell. It just won't update. The sheet is being
refreshed every 2 seconds. What am I doing wrong?
Excel 2000
Windows 2000
Thanks, Mike
Cell contents in H3: <Updates in the cell perfectly.
=IF(D2>650,100,(D2/650)*100)
Happy face code in sheet2:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Address = "$H$3" Then
Application.EnableEvents = False
' min is 0.7181
' max is 0.8111
Select Case Target.Value
Case 0
Shapes("HappyFace").Adjustments.Item(1) = 0.7
Case 50
Shapes("HappyFace").Adjustments.Item(1) = 0.767
Case 100
Shapes("HappyFace").Adjustments.Item(1) = 0.9
Case Else
Shapes("HappyFace").Adjustments.Item(1) _
= 0.7181 + Target.Value / 1000
End Select
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
MsgBox Err.Number & " " & Err.Description
GoTo exitHandler
End Sub
I borrowed the HappyFace Gauge from one of
the experts website. For those unfamiliar, the face will
go from frown to smile as a cell number changes from 0-
100. The gauge works fine by manually entering a number
from 0-100. The problem arises when I use a reference to
update the cell. It just won't update. The sheet is being
refreshed every 2 seconds. What am I doing wrong?
Excel 2000
Windows 2000
Thanks, Mike
Cell contents in H3: <Updates in the cell perfectly.
=IF(D2>650,100,(D2/650)*100)
Happy face code in sheet2:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Address = "$H$3" Then
Application.EnableEvents = False
' min is 0.7181
' max is 0.8111
Select Case Target.Value
Case 0
Shapes("HappyFace").Adjustments.Item(1) = 0.7
Case 50
Shapes("HappyFace").Adjustments.Item(1) = 0.767
Case 100
Shapes("HappyFace").Adjustments.Item(1) = 0.9
Case Else
Shapes("HappyFace").Adjustments.Item(1) _
= 0.7181 + Target.Value / 1000
End Select
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
MsgBox Err.Number & " " & Err.Description
GoTo exitHandler
End Sub