如上,有個user說他的倚天造字檔有1百多個,是否可轉入成windows的造字檔,否則逐一再造 my god!
請問我的VBA那裡出了問題? 這是從YAHOO FINANCE抓資料後計算RSI(相對強弱指標),雖可以計算出來, 但答案是錯的,不知那裡出了問題, 請教高手, 感恩! Sub GetData() Dim QuerySheet As Worksheet Dim DataSheet As Worksheet Dim EndDate As Date Dim StartDate As Date Dim Symbol As String Dim qurl As String Dim nQuery As Name Dim i As Integer, N As Integer, pct As Double Dim j As Integer Dim up As Single Dim down As Single Dim previousValue As Single Dim change As Single Dim cellCount As Integer Dim RS As Single Dim RSI As Single Application.DisplayAlerts = False Application.Calculation = xlCalculationAutomatic Set DataSheet = ActiveSheet N = Range("C1") Clear ' ---------------------------------- For i = 1 To N Range("A1") = i Range("B4") = Cells(i + 2, 11) Range("B4").Select Selection.Copy Range("A1").Select GetOne Range("I8:I600").Select Selection.Copy Cells(3, 12 + i).Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False cellCount = Range("M3:M600").Count previousValue = Cells(3, 12 + i) For j = 4 To cellCount Step 1 change = Cells(j, 12 + i) - previousValue If change >= 0 Then up = up + change Else down = down - change End If previousValue = Cells(j, 12 + i) If down = 0 Then RS = 100 Else RS = (up / (cellCount - 1)) / (down / (cellCount - 1)) End If RSI = 100 - (100 / (1 + RS)) Cells(j, 78 + i) = RSI Next j Cells(2, 12 + i) = Cells(i + 2, 11) '股票代號 Cells(2, 78 + i) = Cells(i + 2, 11) 'RSI 股票代號 Next i End Sub