功能呢?我用它吗?

时间:2017-12-06 13:09:16

标签: excel vba excel-vba

我有一个刷新按钮,上面有这个代码。即使出现错误= REF,我也希望我的电子表格无论何时点击刷新按钮都要刷新!在我的代码中,我说要评估我的一些床单,如果有一个= REF!要做,如果没有= REF!然后将i3和i4记录到我的数据表中。

Sub logs()

Dim Sht As Worksheet
Dim checkRange As Range, CheckCell As Range

For Each Sht In ThisWorkbook.Sheets
With Sht
    Select Case .Name
        Case "Final Four", "Top Left", "Bottom Left", "Top Right", "Bottom Right"
            Set checkRange = .Range("A1:Z100") ' set the range for the current sheet

            For Each CheckCell In checkRange
                If IsError(CheckCell) Then If CheckCell = CVErr(2023) Then Exit Sub
                Next CheckCell

        Case Else
            ' do nothing

    End Select
End With
Next Sht

ActiveSheet.EnableCalculation = True

lst = Sheets("data").UsedRange.Rows.Count
x = lst + 1

    ' Display a message when one of the designated cells has been
    ' changed.
    ' Place your code here.
    Sheets("data").Range("A" & x) = ActiveSheet.Range("I3")
    Sheets("data").Range("B" & x) = ActiveSheet.Range("I4")


End Sub

0 个答案:

没有答案