|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub limonet()
Dim Cn As Object, StrSQL$
Set Cn = CreateObject("adodb.connection")
Cn.Open "provider=microsoft.ace.oledb.12.0;extended properties=excel 12.0;data source=" & ThisWorkbook.FullName
StrSQL = "select last(日期),first(开盘价),max(最高价),min(最低价),last(收盘价),sum(成交量) from (select month(日期) as 月,year(日期)&'-'&datepart('ww',日期) as 周,* from [Sheet1$A:F] where 日期>0) group by "
Range("H2").CopyFromRecordset Cn.Execute(StrSQL & "周")
Range("O2").CopyFromRecordset Cn.Execute(StrSQL & "月")
End Sub |
评分
-
1
查看全部评分
-
|