最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

excel - Run 2 codes on sheet - Stack Overflow

programmeradmin2浏览0评论

I want to run this 2 code at the same time to display animation and run clock at the same time. I tried sub main call each code at the same time but to no avail.

Private Sub workbook_Open()

Dim Hr As Boolean
Hr = Not (Hr)
Do While Hr = True
DoEvents
Range("AJ6") = TimeValue(Now)
Loop

End Sub

Sub Animated_Chart()

    'Declare Variables
    Const StartRow As Long = 2
    Dim LastRow As Long
    Dim RowNumber As Long

    'Get Last Row of Data
Do
    LastRow = Range("BG" & StartRow).End(xlDown).Row

    'Clear Chart & Display Blank Chart
    Range("BG" & StartRow, "BT" & LastRow).ClearContents
    DoEvents
    Application.Wait (Now + TimeValue("00:00:2"))

    'Step Through Each Chart Period
    For RowNumber = StartRow To LastRow
        DoEvents
        Range("BH" & RowNumber, "BT" & RowNumber).Value = Range("AT" & RowNumber, "BF" & RowNumber).Value
        Application.Wait (Now + TimeValue("00:00:3"))
        DoEvents
    Next RowNumber
    
Loop While True

End Sub
发布评论

评论列表(0)

  1. 暂无评论