![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 1
|
I have a worksheet whereby I enter current stock price (SP). I have a stop-loss-sell-price (SLSP) which is 90% of the current stock price. As long as the SP rises, the SLSP will also rise. That is OK. What I want is a way to keep the highest value obtained by the SLSP when/if the SP starts down and goes below the highest recorded SLSP. When this happens, I would like to flag it to SELL. In other words, let the SLSP rise as the SP rises but forbid the SLSP from coming down as the SP comes down.
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
Suppose your stock price data starts in cell A2 and continues down column A. In B2, type the following: =A2*0.9 In B3, type the following: =IF(A3 Please note the mixed absolute/relative referencing. It is important. Copy this down your list. The following event macro will automatically add the formula as entries are added. Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 And Target.Column = 1 And Target.Row >= 2 Then
Range("B" & Target.Row) = _
"=IF(RC[-1]Jay |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: England, UK.
Posts: 526
|
Jay. I'm impressed, so you can get an event macro to enter formulas automatically??
I like the sound of this... RET79 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|