For k = 5 To Cnum + 4
a = Worksheets("相关系数计算法").Cells(1, k)
With Worksheets("沪深300股票")
g = .[A1:KS1].Find(a, LookIn:=xlValues, searchDirection:=xlPrevious).Column
f = Split(Cells(1, g).Address, "$")(1)
End With
Sheets("沪深300股票").Select
Range("" & CStr(f) & "4:" & CStr(f) & "64").Select
Selection.Copy
Sheets("相关系数计算法").Select
Range("F200").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
For i = 200 To 200 + 60 - 1
s = Application.Ln(Cells(i, 6) / Cells(i + 1, 6))
Cells(i - 194, k) = s
Next i
Next k
excel vba 效率 for循环
答案:2 悬赏:70 手机版
解决时间 2021-02-26 06:08
- 提问者网友:星軌
- 2021-02-25 22:57
最佳答案
- 五星知识达人网友:第幾種人
- 2021-02-25 23:15
For i = 200 To 200 + 60 - 1
s = Application.Ln(Cells(i, 6) / Cells(i + 1, 6))
Cells(i - 194, k) = s
Next i
直接
For i = 200 To 259
s = Application.Ln(Cells(i, 6) / Cells(i + 1, 6))
Cells(i - 194, k) = s
Next i
s = Application.Ln(Cells(i, 6) / Cells(i + 1, 6))
Cells(i - 194, k) = s
Next i
直接
For i = 200 To 259
s = Application.Ln(Cells(i, 6) / Cells(i + 1, 6))
Cells(i - 194, k) = s
Next i
全部回答
- 1楼网友:荒野風
- 2021-02-25 23:43
excel vba一般有下面几种循环语句:
1、for ... next
for i=1 to 100
cells(i,1)=i
next
2、do until ... loop
i=1
do until i=100
cells(i,1)=1
i=i+1
loop
3、do while ... loop
i=1
do while i<=100
cells(i,1)=1
i=i+1
loop
可以根据情况选择使用
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯