• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

excel-stock-quotes does not work for some stocks -- ALGN and TFM

joseph168

New Member
Dear Support team,


Thanks very much for the website http://chandoo.org/wp/2010/06/02/excel-stock-quotes/


It works great for most of the stocks, but I have found a problem with these two stocks, ALGN and TFM. The last Trade Price was blank.


I will be very appreciate for your suggestion!


Regards,

Joseph
 
My guess is that it's part of the "comma in a name" bug that Daniel mentions here:

http://chandoo.org/wp/2010/06/02/excel-stock-quotes/#comment-109733

The updated file catches most of the problems, but it appears that there are others. Looking in the code, I'd recomend changing the PostProcessActiveRange macro to this

[pre]
Code:
Private Sub PostProcessActiveRange()

Dim vArr As Variant
Dim i As Long

If rnAR_Dest.Columns.Count > 2 Then
Application.DisplayAlerts = False

''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This code deals with the comma bug in the Name of a
' company, if it is returned before a numeric value.
' In this case, YF does not enclose the name of
' a company in quotation marks. As a result a comma
' in the name of a corporation (, Inc.) will be treated
' as a field separator by the TextToColumns procedure.
' This code removes such commas. It is unknown what
' impact this may cause on other attributes, but most
' attributes are numeric and so unaffected.
vArr = rnAR_Table.Resize(rnAR_Dest.Rows.Count - 1, 1)
For i = LBound(vArr) To UBound(vArr)
vArr(i, 1) = Replace(vArr(i, 1), ", ", " ")

'The following line was added by Luke M to handle blank columns
vArr(i, 1) = Replace(vArr(i, 1), ",,", ",")
Next i
Application.EnableEvents = False
rnAR_Table.Resize(rnAR_Dest.Rows.Count - 1) = vArr
Application.EnableEvents = True
''''''''''''''''''''''''''''''''''''''''''''''''''''''''

rnAR_Table.Resize(rnAR_Dest.Rows.Count).TextToColumns Destination:=rnAR_Table, DataType:=xlDelimited, Comma:=True
Application.DisplayAlerts = True
Worksheets(stAR_ConfigSheetName).[ar_LocalTimeLastUpdate] = Now
End If

End Sub
[/pre]
 
Back
Top