Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 使用数组将大量数据放入工作表中_Arrays_Excel_Jagged Arrays - Fatal编程技术网

Arrays 使用数组将大量数据放入工作表中

Arrays 使用数组将大量数据放入工作表中,arrays,excel,jagged-arrays,Arrays,Excel,Jagged Arrays,我正在将43个股票符号历史定价下载到excel 2013中。我的代码使用一个2d数组,然后将其转置并插入到一张表中。它工作得很好,直到我尝试下载43个symobls的1990年定价。似乎一旦数组的第二维度超过一定量,单元格值就会变为#N/a,就像第1列的某个点一样。关于锯齿数组(嵌套数组)有什么想法吗?但我如何循环以获得所需的输出范围?谢谢你的建议 RERFX RFNCX RWICX SASMX SGRKX SGRKX SMGIX TRSGX VETAX VIMAX VINIX VIPSX VS

我正在将43个股票符号历史定价下载到excel 2013中。我的代码使用一个2d数组,然后将其转置并插入到一张表中。它工作得很好,直到我尝试下载43个symobls的1990年定价。似乎一旦数组的第二维度超过一定量,单元格值就会变为#N/a,就像第1列的某个点一样。关于锯齿数组(嵌套数组)有什么想法吗?但我如何循环以获得所需的输出范围?谢谢你的建议

RERFX RFNCX RWICX SASMX SGRKX SGRKX SMGIX TRSGX VETAX VIMAX VINIX VIPSX VSCAX WACPX WAPAX WASAX 5/15/2002 6/4/2002 6/6/2002 1/1/2001 8/30/2002 8/30/2002 1/1/2001 1/1/2001 5/5/2000 11/12/2001 1/1/2001 6/29/2000 1/1/2001 1/2001 1/1/1/2001 5/21/2012 5/21/2012

这些是符号和日期。我为所有符号创建了一个范围,然后用符号本身创建范围来创建开始日期

Sub GetDailyReturnsTest()
Dim URL As String, today As String, http As Object, csv As String, temp() As String
Dim txt As String, r As Integer, a As Single, b As String, s As Double, ticker As Variant, icountSymbol As Integer, sTicker As String
Dim iSymbol As Integer, dateParams As String, t As Double, sym As range

Application.ScreenUpdating = False



Set ticker = Application.[fundsymbols]
icountSymbol = ticker.Count

ReDim temp(8, 0)

today = Date
For Each sym In ticker
dateParams = "&a=" & Month(range(sym)) - 1 & "&b=" & Day(range(sym)) & "&c=" & Year(range(sym)) & "&d=" & Month(Now) & "&e=" & Day(Now) & "&f=" & Year(Now)





sTicker = ticker(1, iSymbol)

URL = "http://ichart.finance.yahoo.com/table.csv?s=" & sTicker & dateParams & "g=d&ignore=.csv"


On Error Resume Next

Set http = CreateObject("msxml2.xmlhttp")
http.Open "get", URL, False
http.send
csv = http.ResponseText
r = 0
txt = ""
For a = 1 To Len(csv)
b = Mid(csv, a, 1)
If b = "," Then
    temp(r, UBound(temp, 2)) = txt
    r = r + 1
    txt = ""
ElseIf b = Chr(10) Then
temp(r, UBound(temp, 2)) = txt
r = r + 1
txt = sTicker
temp(r, UBound(temp, 2)) = txt
ReDim Preserve temp(UBound(temp, 1), UBound(temp, 2) + 1)
txt = ""
r = 0
Else
    txt = txt & b
End If
Next a
Next sym
Worksheets("FundsHistoricalPricing").Activate
On Error Resume Next


With ActiveSheet.Cells
.ClearContents
.ClearFormats
End With

range("a2").Resize(UBound(temp, 2) + 1, UBound(temp, 1)).Value = Application.Transpose(temp)
end sub

我们需要查看代码。如果您添加闯入,数组是否具有正确的数据?如果您查看数组中的所有数据,是否具有正确的数据。问题似乎发生在代码的转置部分。