請問Hsieh 前輩~
這兩次的程式碼差別最主要是"x = Application.Max(3, C.Row - 14)"嗎?代表意思是?!
如果我要改抓除息日後30日的報酬是不是將部分程式碼改掉即可?!
If Not C Is Nothing And Not B Is Nothing Then
x = Application.Max(3, C.Row - 14)
Set B1 = .[A1:A2]
Set B2 = B.Resize(2, 1)
Set Rng = .Cells(x, 1).Resize(30, 1)
Set Rng1 = .Cells(x, B.Column).Resize(30, 1)
With sht
B1.Copy .Cells(r, k)
B2.Copy .Cells(r, k + 1)
Rng.Copy .Cells(r + 2, k)
Rng1.Copy .Cells(r + 2, k + 1)
End With
k = IIf(k = 255, 1, k + 2)
r = IIf(k = 1, r + 33, r)
Else
MsgBox "無此除權資料"
前輩您好:
我研究了這次得程式碼和之前的程式碼有何不同,發現不同之處在於
mystr = A & "," & A.Offset(, 1)d(mystr) = DateValue(Format(A.Offset(, 1), "0000/00/00"))
Next
End With
k = 1: r = 1
For Each ky In d.keys
y = Left(Split(ky, ",")(1), 4)
With Sheets(y)
請問Left(A.Offset(, 1), 4)有什麼差別呢?
再請問如果我只想要顯示事件日後第五天的報酬我應該怎麼改呢?
(舉例來說,事件日是20041119,則我要20041123的資料(t+4))
我試了好久還是不成功耶!= =
非常感謝!^^作者: Hsieh 時間: 2011-3-28 08:30
至於程式問題點是出在
Set C = .Columns("A").Find(d(ky), lookat:=xlWhole)
Set B = .Rows(1).Find(Split(ky, ",")(0), lookat:=xlPart)
加入搜尋參數就能正確找到資料了作者: candy516 時間: 2011-3-31 19:06