資料排序反轉
這是用巨集錄的資料排序反轉請問有簡單的寫法
如何解除鎖定工作列
謝謝 [i=s] 本帖最後由 wufonna 於 2013-10-5 10:22 編輯 [/i]
又請問我想畫出河流圖,參考 c_c_lai 大的
[url]http://forum.twbts.com/thread-6531-1-1.html[/url]
如何錯誤,謝謝 [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59132&ptid=10531]2#[/url] [i]wufonna[/i] [/b]
試試看!
[attach]16248[/attach]
[attach]16249[/attach]
解決方法如下:
1. .SetSourceData Source:=Range("data!$A$4:data!$A$" & totalRows & ", data!$B$4:data!$E$" & totalRows)
出現錯誤訊息; 但不予理會,其問題是因 totalRows 值 = 3075 (超出 255) 所引發。
2. 在 ActiveSheet.Shapes.AddChart.Select 上一行, 故意補上一行: (輸入)
totalRows = 100
然後、再重新執行 drawCharts(), 待正常繪出圖表後再將 totalRows = 100 那一行刪除掉,再執行 drawCharts,
之後便一切 OK 解決了。至於為何會出現此錯誤訊息,可能要請教各位前賢了!
3. 祝順意! 謝謝 c_c_lai 大大
這是改過的檔案
請問如何加入縱的格線,下面的日期顯示幾年一月,隱藏數列1 數列2 數列3 數列4
6,783.3 改成 第四列的 1.12 1.09 1.06 1.03 1 0.97 0.94 0.91 0.88
如下面的圖例,謝謝
下面的 vba 有簡單的寫法嗎
'取得圖表的最大、最小值
Sub GetMinMax()
With Sheets("data")
Dim VMin As Single, VMax As Single
Dim VIMin As Single, VIMax As Single
Dim i As Integer
VMin = .Cells(5, 9).Value
VMax = .Cells(5, 9).Value
'Debug.Print "VMin =" & VMin
'Debug.Print "VMax =" & VMax
For i = 5 To .Range("I" & .Rows.Count).End(xlUp).Row
If .Cells(i, 9).Value < VMin Then
VMin = .Cells(i, 9).Value
' Debug.Print "VMin =" & VMin
' Debug.Print i
GoTo NNN
End If
If .Cells(i, 9).Value > VMax Then
VMax = .Cells(i, 9).Value
' Debug.Print "VMax =" & VMax
' Debug.Print i
End If
NNN:
Next
' Debug.Print "VMin =" & VMin
' Debug.Print "VMax =" & VMax
VIMin = Int(VMin * 0.88 / 1000) * 1000
VIMax = Int(VMax * 1.12 / 1000) * 1000 + 1000
' Debug.Print VIMin
' Debug.Print VIMax
End With
End Sub
圖例的股價最小 VIMin,最大值 VIMax vba 如何 寫 謝謝 [i=s] 本帖最後由 stillfish00 於 2013-10-9 16:00 編輯 [/i]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59245&ptid=10531]4#[/url] [i]wufonna[/i] [/b]
[quote]下面的 vba 有簡單的寫法嗎[/quote][code] With Sheets("data")
VIMin = Int(Application.WorksheetFunction.Min(.Range(.[I5], .[I5].End(xlDown))) * 0.88 / 1000) * 1000
VIMax = Int(Application.WorksheetFunction.Max(.Range(.[I5], .[I5].End(xlDown))) * 1.12 / 1000) * 1000 + 1000
End With[/code] 謝謝 stillfish00 大大
小弟對vba圖表的指令/__\
圖好像沒作用,不知指令下在那
Option Explicit
Sub drawCharts()
Dim toindexRows As Single, totalRows As Single, totalRows2 As Single
Dim xRow, yCol, cHeight, cWidth As Integer
Dim text As String
Dim chartname As String
Dim sRowHeight As Single
Dim VIMin As Single, VIMax As Single
xRow = 3
yCol = 1
cHeight = 31 'CHeight 定義為圖表所佔的列高
cWidth = 874
With Sheets("data")
VIMin = Int(Application.WorksheetFunction.Min(.Range(.[I5], .[I5].End(xlDown))) * 0.88 / 1000) * 1000
VIMax = Int(Application.WorksheetFunction.Max(.Range(.[I5], .[I5].End(xlDown))) * 1.12 / 1000) * 1000 + 1000
End With
Sheets("chart").Select
ActiveSheet.ChartObjects.Delete
toindexRows = Sheets("data").Range("I" & Rows.Count).End(xlUp).Row - 1100 '約取三年資料
totalRows = Sheets("data").Range("A" & Rows.Count).End(xlUp).Row ' 傳回 B 欄所使用儲存格之最後一格之列號
totalRows2 = Sheets("data").Range("I" & Rows.Count).End(xlUp).Row ' 傳回 I 欄所使用儲存格之最後一格之列號
' '先把列高找出來, 才好算出圖要佔幾列, 兩個圖才好連在一起
' sRowHeight = Sheets("data").Rows(3).RowHeight
ActiveSheet.Shapes.AddChart.Select
With ActiveChart
.SetSourceData Source:=Range("data!$A$" & toindexRows & ":data!$A$" & totalRows2 & ", data!$B$" & toindexRows & ":data!$E$" & totalRows2)
Debug.Print totalRows
.ChartType = xlStockOHLC
With .ChartGroups(1)
.AxisGroup = 1
' .UpBars.Format.Fill.ForeColor.RGB = RGB(255, 0, 0) ' 紅色
.UpBars.Format.Fill.ForeColor.RGB = RGB(255, 69, 0) ' 橘紅色
' .DownBars.Format.Fill.ForeColor.RGB = RGB(0, 32, 96) ' 深藍色
.DownBars.Format.Fill.ForeColor.RGB = RGB(0, 250, 170) ' 淺洋綠色
End With
.SeriesCollection.Add Source:=Range("data!$J$" & toindexRows & ":data!$R$" & totalRows2)
' .SeriesCollection.Add Source:=Range("data!$J$" & toindexRows & ":data!$R$" & totalRows)
Debug.Print totalRows
With .SeriesCollection(5)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 170) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(6)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 160) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(7)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 150) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(8)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 140) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(9)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 130) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(10)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 120) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(11)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 110) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(12)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 100) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
With .SeriesCollection(13)
.Name = "=data!$J$" & toindexRows
.ChartType = xlLine
With .Format.Line
.Visible = msoTrue ' 主力界入
' .ForeColor.RGB = RGB(105, 205, 170) ' 主力界入指數顯示之顏色 --- 藍綠色
.ForeColor.RGB = RGB(32, 178, 180) ' 主力界入指數顯示之顏色 --- 海洋綠色
.Transparency = 0
.Weight = 1 '線條寬度
End With
End With
' .Axes(xlValue).TickLabels.NumberFormatLocal = "0_ "
With .Axes(xlCategory) ' X座標軸 (時間軸)
' .CategoryType = xlCategoryScale
' .TickLabels.NumberFormatLocal = "hh:mm"
' .MajorTickMark = xlNone
' .Border.Weight = xlHairline
' .Border.LineStyle = xlNone
' .TickLabelPosition = xlLow
' .TickLabels.Font.Size = 10
.MaximumScale = VIMax
.MinimumScale = VIMin
End With
' .ChartArea.Height = cHeight * sRowHeight ' 將原本設定之高度調至適度位置
' .ChartArea.Width = cWidth
'
' text = "股票圖 K 線、主力、散戶、與成交量"
'
' .SetElement (msoElementChartTitleCenteredOverlay)
' .ChartTitle.text = text
' .ChartTitle.Format.TextFrame2.TextRange.Font.Size = 14
' .Legend.Position = xlCorner ' 將圖表圖示從圖表最下方調整到圖表之右上角位置
End With
chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
ActiveSheet.Shapes(chartname).Left = Cells(xRow, yCol).Left ' 設定此圖表實際擺放的 X、Y 座標位置。
ActiveSheet.Shapes(chartname).Top = Cells(xRow, yCol).Top
Range("A1").Select
'Debug.Print Sheets("data").Range("A" & Rows.Count).End(xlUp).Row
'Debug.Print Sheets("data").Range("I" & Rows.Count).End(xlUp).Row
Debug.Print toindexRows
End Sub [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59256&ptid=10531]6#[/url] [i]wufonna[/i] [/b]
回復當事者時,請點按 "回復" 選鈕,否者當事人是無法得知
你是否答覆回應,這也是一種禮貌與尊重。
你的問題是否如圖?
[attach]16281[/attach] [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59261&ptid=10531]7#[/url] [i]c_c_lai[/i] [/b]
謝謝 c_c_lai 大
昨天查了一晚,清楚了一些 VBA
還有問題請教大大
我把主線圖的
.SeriesCollection(1).Name = "" ' 開盤價
.SeriesCollection(2).Name = "" ' 最高價
.SeriesCollection(3).Name = "" ' 最低價
.SeriesCollection(4).Name = "" ' 收盤價 (成交價)
拿掉,前有一個空格(如圖),請問 大大可否調到中間來,謝謝 [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59268&ptid=10531]8#[/url] [i]wufonna[/i] [/b]
.HasLegend = 不是 True , 便是 False
試過的結果是無法將其中任一的 Legent 位置移開。 [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59270&ptid=10531]9#[/url] [i]c_c_lai[/i] [/b]
謝謝 大大 我從中得到不少知識,
我研究好[url=http://forum.twbts.com/thread-6527-1-1.html]擷取歷史股價[/url]
再請教大大
^0^ [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59270&ptid=10531]9#[/url] [i]c_c_lai[/i] [/b]
又來請教大大
從網路下載的資料是日期反的,而圖表反向,
請問 大大要修改那個地方
謝謝 [i=s] 本帖最後由 c_c_lai 於 2013-10-11 20:02 編輯 [/i]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59317&ptid=10531]11#[/url] [i]wufonna[/i] [/b][code]
Sub MySort()
Dim EndKBarRow As Long
With Sheets("data")
EndKBarRow = .Range("A" & Rows.Count).End(xlUp).Row
With .Sort
.SortFields.clear
.SortFields.Add Key:=Range("A5"), SortOn:=xlSortOnValues, Order:=xlAscending
' 資料由小而大依序排序
' .SortFields.Add Key:=Range("A5"), SortOn:=xlSortOnValues, Order:=xlDescending
' 資料由大而小依序排序
.SetRange Range("A5:R" & EndKBarRow)
' .Header = xlNone
.Apply
End With
End With
End Sub
[/code] [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59323&ptid=10531]12#[/url] [i]c_c_lai[/i] [/b]
感謝大大,已作出大盤,謝謝 ^o^ [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59327&ptid=10531]13#[/url] [i]wufonna[/i] [/b]
你在 drawCharts() 最前、及最後加上一行 (如下) 繪圖完成後畫面會更清爽。[code]
Sub drawCharts()
Dim toindexRows As Single, totalRows As Single, totalRows2 As Single
Dim VIMax As Single, VIMin As Single
Dim xRow, yCol, cHeight, cWidth As Integer
Dim text As String
Dim chartname As String
Dim sRowHeight As Single
' xRow = 3
xRow = 1
yCol = 1
' cHeight = 450 'CHeight 定義為圖表所佔的列高
' cWidth = 700
cHeight = 360 ' CHeight 定義為圖表所佔的列高
cWidth = 720
[/code][code]
Sheets("chart").[A1].Select
End Sub
[/code] [i=s] 本帖最後由 c_c_lai 於 2013-10-12 07:43 編輯 [/i]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59327&ptid=10531]13#[/url] [i]wufonna[/i] [/b]
我在 drawCharts() 加了一小段程式,它將標題移出繪圖區,
如此,比較不會壓到 K 線圖的繪製 (附上: 前、後的圖表提供比較):[code]
.ChartArea.Height = cHeight ' 圖表高度
.ChartArea.Width = cWidth ' 圖表寬度
'
With .PlotArea ' 圖表的繪圖區
.Top = 20 ' 圖表的實際繪圖區起始位置
.Left = 1
.Width = .Parent.ChartArea.Width
.Height = .Parent.ChartArea.Height
.Interior.ColorIndex = xlNone
.InsideHeight = cHeight - 70 ' 調整圖表的繪圖區內部高度 (為配合.Legend.Position = xlBottom )
End With
[/code][attach]16316[/attach]
[attach]16317[/attach] [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59333&ptid=10531]15#[/url] [i]c_c_lai[/i] [/b]
謝謝 大大
找了好久來到了這版版,又看到了大大的 [url=http://forum.twbts.com/viewthread.php?tid=6531]K 線股票圖如何能與主力、散戶、及成交量線共存?[/url] 線圖共存,學習做流河圖,謝謝 大大 無私的教導。 [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59349&ptid=10531]16#[/url] [i]wufonna[/i] [/b]
我將 "台灣加權指數-報酬率區間圖III" 稍稍整理了一下,
並加以程式碼對位,希望對你能有所助益。
drawCharts2() 是我常應用的繪圖方式,供你參考!
[attach]16320[/attach] [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59350&ptid=10531]17#[/url] [i]c_c_lai[/i] [/b]
謝謝 大大 ^0^ 河流圖網址無效
參考一些資料
https://finance.yahoo.com/quote/2330.TW/history?period1=1575244800&period2=1631404800&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true
Private Const Unix1970 As Long = 25569 'CDbl(DateSerial(1970, 1, 1))
'Dim s As String
Public Function Date2Unix(ByVal vDate As Date) As Long
Date2Unix = DateDiff("s", Unix1970, vDate)
End Function
Sub test()
Debug.Print s
Debug.Print DateDiff("s", Unix1970, vDate)
Debug.Print Date2Unix("2019/6/7")
Debug.Print Date2Unix(Date - 365 * 3) '取三年
Debug.Print Now()
Debug.Print Date
Debug.Print Date2Unix(Date)
Debug.Print "https://finance.yahoo.com/quote/2330.TW/history?period1=" & Date2Unix("2019/6/7") & "&period2=" & Date2Unix(Date) & "&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true"
End Sub
'debug
'
'-2209161600
' 1559865600
' 1536796800
'2021/9/12 下午 09:45:15
'2021/9/12
' 1631404800
'https://finance.yahoo.com/quote/2330.TW/history?period1=1559865600&period2=1631404800&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true
'https://white5168.blogspot.com/2017/03/unix-timestamp-excel-vba.html?fbclid=IwAR1FQDyY3A1utM3vaT24SKcoybW02PUycFBWuW8JXncdCfzk5wTEDZgi3vw#.YT33950zbcs
'https://www.cadch.com/article/timestamp/index.php
'https://finance.yahoo.com/quote/2330.TW/history?period1=1575244800&period2=1631404800&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true
'http://forum.twbts.com/thread-22471-1-2.html?fbclid=IwAR0V3t8wojYYInLQXamUi6ZJqPeSRQGHhSR9RBia2xRh5YJw2ZIUvxMDWSw
'參考資料
'debug.print https://finance.yahoo.com/quote/2330.TW/history?period1=" & Date2Unix("2019/6 [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=59128&ptid=10531]1#[/url] [i]wufonna[/i] [/b]
https://www.mobile01.com/topicdetail.php?f=511&t=4737630&p=28
參考 274樓 修改 河流圖[code]Sub Getyahoofinance_Jsondata()
Dim Xmlhttp As Object, FileName As String, Url As String, urla As String, Crumbkey As String, stock As String, startday As String, endday As String
Dim Jsondata As Object, DecodeJson, temp
Dim TimeStamp, adjclose, quote_Open, quote_High, quote_Low, quote_Close, quote_Volume
Dim ttt, I
Set Jsondata = CreateObject("HtmlFile")
Jsondata.write "<script>document.JsonParse=function (s) {return eval('(' + s + ')');}</script>"
' Sheets("工作表1").Cells.Clear
' Sheets("工作表1").Range("a1:g1") = Array("Date", "Open", "HIgh", "Low", "Close", "Adj Close", "Volume")
With 工作表1
Dim AR
AR = .Range("A1:G4")
.Range("A:G") = ""
.Range("A1:G4") = AR
End With
stock = InputBox("股票代號", , "^TWII")
startday = Format(InputBox("開始日期(8碼數字)", , "20170101"), "####/##/##")
endday = Format(InputBox("結束日期(8碼數字)", , Format(Date, "yyyymmdd")), "####/##/##")
If startday > endday Or stock = "" Or startday = "" Or endday = "" Then
MsgBox "資料輸入錯誤", vbOKOnly, "請重新輸入"
Exit Sub
End If
ttt = Timer
Url = "https://finance.yahoo.com/quote/" & stock & "/history?period1=" & DataToUnixTime(startday) & "&period2=" & DataToUnixTime(endday) & "&interval=1d&filter=history&frequency=1d"
Set Xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
With Xmlhttp
.Open "GET", Url, False
.send
Crumbkey = Left(Split(.responsetext, """CrumbStore"":{""crumb"":""")(1), 11)
urla = "https://query2.finance.yahoo.com/v8/finance/chart/" & stock & "?formatted=true&crumb=" & Crumbkey & "&lang=en-US®ion=US&period1=" & DataToUnixTime(startday) & "&period2=" & DataToUnixTime(endday) & "&interval=1d&events=div%7Csplit&corsDomain=finance.yahoo.com"
.Open "GET", urla, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Referer", Url
.send
Set DecodeJson = Jsondata.JsonParse(.responsetext)
Set temp = CallByName(CallByName(CallByName(DecodeJson, "chart", VbGet), "result", VbGet), "0", VbGet)
TimeStamp = Split(CallByName(temp, "timestamp", VbGet), ",")
adjclose = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "adjclose", VbGet), "0", VbGet), "adjclose", VbGet), ",")
quote_Open = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "quote", VbGet), "0", VbGet), "open", VbGet), ",")
quote_High = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "quote", VbGet), "0", VbGet), "high", VbGet), ",")
quote_Low = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "quote", VbGet), "0", VbGet), "low", VbGet), ",")
quote_Close = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "quote", VbGet), "0", VbGet), "close", VbGet), ",")
quote_Volume = Split(CallByName(CallByName(CallByName(CallByName(temp, "indicators", VbGet), "quote", VbGet), "0", VbGet), "volume", VbGet), ",")
End With
With 工作表1
Application.ScreenUpdating = False
For I = 0 To UBound(TimeStamp)
.Cells(I + 5, 1) = Format(TimeStamp(I) / 86400 + #1/1/1970 8:00:00 AM#, "yyyy/mm/dd")
.Cells(I + 5, 2) = quote_Open(I)
.Cells(I + 5, 3) = quote_High(I)
.Cells(I + 5, 4) = quote_Low(I)
.Cells(I + 5, 5) = quote_Close(I)
.Cells(I + 5, 6) = adjclose(I)
.Cells(I + 5, 7) = quote_Volume(I)
.Cells.EntireColumn.AutoFit
' .Cells(1, 1).Select
Next I
' Application.ScreenUpdating = True
' MsgBox "開始日期" & startday & vbNewLine & "結束日期" & endday & vbNewLine & _
' "股票代號" & stock & vbNewLine & "資料筆數" & .Range("a1").CurrentRegion.Rows.Count - 1 & "筆" & vbNewLine & _
' "使用時間" & Round(Timer - ttt, 2) & "秒", vbOKOnly, "下載完成"
End With
Set Xmlhttp = Nothing
Set DecodeJson = Nothing
Set temp = Nothing
End Sub
Sub DeleteEmptyRows()
Dim LastRow As Long, r As Long
With 工作表1
LastRow = .Range("A" & .Rows.Count).End(xlUp).Row
LastRow = LastRow + .Range("A" & .Rows.Count).End(xlUp).Row
For r = LastRow To 5 Step -1
If .Cells(r, 2) = "" Then
Debug.Print .Cells(r, 1).Value
.Rows(r).Delete
End If
Next r
End With
Application.ScreenUpdating = True
End Sub
Function DataToUnixTime(dstring) As Long
DataToUnixTime = (DateValue(dstring) - #1/1/1970 8:00:00 AM#) * 86400
End Function
[/code]
頁:
[1]