I am facing this error when i run this code. the values in SelectRangeAuto is all 0. all are empty cells. the error is caused by AllUnrealizedPandL = WorksheetFunction.Sum(SelectRangeAuto). Please help. Thanks
Code:
Dim SelectRangeAuto As Variant
Dim AllUnrealizedPandL As Double
With Sheets(EmailSheetAuto)
SelectRangeAuto = .Range(.Range("J2"), .Range("J2").End(xlDown))
If .Range("J2").Value <> "" Then
AllUnrealizedPandL = WorksheetFunction.Sum(SelectRangeAuto)
End If
End With