espenskeie
Well-known Member
- Joined
- Mar 30, 2009
- Messages
- 636
- Office Version
- 2016
- Platform
- Windows
Hi
I seem to have some problems with the sum function, the result is 0.
In those cells that I try to sum there are formulas, one =AVERAGE formula, and in the other cell a =STDEV formula.
This is my code:
Regards
Espen
I seem to have some problems with the sum function, the result is 0.
In those cells that I try to sum there are formulas, one =AVERAGE formula, and in the other cell a =STDEV formula.
This is my code:
Code:
Sub FillPeriodeAnalyze() ''''''''''''' Husk å endre denne dersom det legges en liste med tickere
Dim lr10 As Long
Dim m As Long
Dim longlimit As Long
Dim shortlimit As Long
lr10 = Sheets("1HourDATA").Range("V65536").End(xlUp).Row
With Sheets("1HourDATA")
longlimit = Application.WorksheetFunction.Sum(.Range("AR2:AS2"))
shortlimit = Application.WorksheetFunction.Sum(.Range("BB2:BC2"))
End With
For m = 2 To lr10
If Sheets("1HourDATA").Range("V" & m) >= longlimit Then
If Sheets("1HourDATA").Range("Z" & m) = "Low" Then
Sheets("1HourDATA").Range("AB" & m).Value = 1
End If
End If
If Sheets("1HourDATA").Range("W" & m) >= shortlimit Then
If Sheets("1HourDATA").Range("AA" & m) = "High" Then
Sheets("1HourDATA").Range("AB" & m).Value = 1
End If
End If
If Sheets("1HourDATA").Range("Z" & m).Value = "Low" Then
If Sheets("1HourDATA").Range("AA" & m).Value = "High" Then
Sheets("1HourDATA").Range("AB" & m).Value = ""
End If
End If
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
Regards
Espen