我想要一个excel表格的首尾相接自动循环滚动的VBA,就像列车时刻表那样,上下自动循环滚动的那种,求大神
2个回答
展开全部
给个小例子给你
譬如A列是数据,运行Roll过程会在B列滚动,其他自己完善修改
Dim NextTime As Date
Dim DataArr
Dim m As Integer
Dim TestArr(1 To 5, 1 To 1)
Sub TimeOnTime()
NextTime = Now + TimeValue("0:0:2")
m = m + 1
m = (m - 1) Mod 15 + 1
For k = m To m + 4
n = n + 1
TestArr(n, 1) = DataArr((k - 1) Mod 15 + 1, 1)
Next
Range("b1:b5") = TestArr
Application.OnTime NextTime, "TimeOnTime"
End Sub
Sub Roll()
DataArr = Range("a1:a15")
TimeOnTime
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询