|   | A | B | C | D | E |
| 1 | COMPANY | CLOSING PRICE | BETA | STOP LOSS SELL PRICE | DECISION |
| 2 | CSCO | 53.50 | 90% | 48.15 | hold |
| 3 | BBBY | 36.06 | 90% | 32.45 | hold |
| 4 | xxxx | 79.00 | 80% | 63.20 | hold |
| 5 | yyyy | 108.00 | 80% | 112.00 | SELL |
The following is an EVENT macro.
Right-click on the sheetname, view code, and paste code in. You will want to format your columns.
If you are change your Beta your Stop Loss Prices will change current to the change of the Beta.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Then Exit Sub
Dim entry As Range
If Target.Column = 3 Then
On Error Resume Next
For Each entry In Intersect(Range("C:C"), Selection)
entry.Offset(0, 1).Value = 1 * entry.Value * entry.Offset(0, -1).Value
entry.Offset(0, 2).Value = "'--" 'changed percent
Next entry
Exit Sub
End If
If Target.Column <> 2 Then Exit Sub
If IsNumeric(Target) = False Then Exit Sub
If IsEmpty(Target.Offset(0, 1)) Then Target.Offset(0, 1).Value = 0.9
If IsEmpty(Target.Offset(0, 2)) Then
Target.Offset(0, 2).Value = Target.Offset(0, 1).Value * Target.Value
Target.Offset(0, 3).Value = "'---" 'Just entered purchase
End If
If Target.Value < Target.Offset(0, 2).Value Then
'can also be enhanced by Conditional Formatting
Target.Offset(0, 3) = "SELL"
End If
If Target.Value * Target.Offset(0, 1).Value >= Target.Offset(0, 2).Value Then
Target.Offset(0, 2) = Target.Offset(0, 1).Value * Target.Value
Target.Offset(0, 3) = "hold"
'Target.Offset(0,5) = Target.value 'if you want to see high water mark
End If
End Sub
Please send your comments concerning this web page to: David McRitchie send email comments
Copyright © 1997 - 2004, F. David McRitchie, All Rights Reserved