Problem with dates

  • Thread starter Thread starter fabio.folino
  • Start date Start date
F

fabio.folino

I'm writing my first vba function. I'm trying to test using and addin
that requires the date to be in the mm/dd/yyyy format. I want to test
from a specific start date to today and find the highest value. Here
is the code i have.

Function TestHigh(tSymbol As String, tDate As String)
Dim dHighDate As Date
Dim sHighPrice As Single
Dim iCounter As Integer
Dim sTestPrice As Single
sHighPrice = xlq(Symbol, "close", sDate)
dHighDate = tDate
dHighDate = dHighDate + 1
For counter = dHighDate To Date
sTestPrice = xlq(tSymbol, "close", Str(dHighDate))
If sTestPrice > sHighPrice Then
sHighPrice = sTestPrice
dHighDate = iCounter
End If
Next iCounter
TestHigh = sHighPrice
End Function

When i run the function its not even going into the for loop. Any
Ideas?
 
I'm writing my first vba function. I'm trying to test using and addin
that requires the date to be in the mm/dd/yyyy format. I want to test
from a specific start date to today and find the highest value. Here
is the code i have.

Function TestHigh(tSymbol As String, tDate As String)
Dim dHighDate As Date
Dim sHighPrice As Single
Dim iCounter As Integer
Dim sTestPrice As Single
sHighPrice = xlq(Symbol, "close", sDate)
dHighDate = tDate
dHighDate = dHighDate + 1
For counter = dHighDate To Date
sTestPrice = xlq(tSymbol, "close", Str(dHighDate))
If sTestPrice > sHighPrice Then
sHighPrice = sTestPrice
dHighDate = iCounter
End If
Next iCounter
TestHigh = sHighPrice
End Function

When i run the function its not even going into the for loop. Any
Ideas?

Something with your "xlq" function?
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top