by mclarens » Thu Feb 07, 2008 2:47 pm
this is not the best ... i am not good with vba and u can thank capt sensible and alistair for the following code
step 1
goto w1 and enter =IF(E2="In Play","in play","")
step 2
right click on sheet 1 tab and press View Code
Cut and paste the following
It is triggered by W1 changing to "in play"
Public bOddsCopied As Boolean
Public sRaceDets As String
Private Sub Worksheet_Calculate()
' Reset the flags if a new race is loaded
If LCase(Range("A1").Value) <> sRaceDets Then
sRaceDets = LCase(Range("A1").Value)
bOddsCopied = False
End If
' Check to see if race has just gone In-Play (status is held in cell W1)
If LCase(Range("W1").Value) = "in play" And bOddsCopied = False Then
' Copy last matched prices into column AH
Application.EnableEvents = False
For theRow = 5 To 44
Range("AH" & theRow).Value = Range("O" & theRow).Value
Next theRow
Application.EnableEvents = True
bOddsCopied = True
End If
End Sub
result last traded price sitting col AH ..... and off you go
It works.