相关疑难解决方法(0)

如何在Excel VBA中获取已更改单元格的旧值?

我正在检测Excel电子表格中某些单元格值的变化,如下所示......

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Dim old_value As String
Dim new_value As String

For Each cell In Target

    If Not (Intersect(cell, Range("cell_of_interest")) Is Nothing) Then
        new_value = cell.Value
        old_value = ' what here?
        Call DoFoo (old_value, new_value)
    End If

Next cell

End Sub
Run Code Online (Sandbox Code Playgroud)

假设这不是一种编码方式,那么在更改之前如何获取单元格的值?

excel vba excel-vba

42
推荐指数
5
解决办法
11万
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1