我需要列“F”中的单元格来清除何时在“J”列的同一行中更新了训练日期

问题描述 投票:-3回答:1

我需要列“F”中的单元格,以便在“J”列的同一行中更新培训日期时清除内容。

excel-vba vba excel
1个回答
0
投票

在工作表的VBA中(在VBE的VBAProject窗格中单击该工作表)。使用Worksheet_Change()事件。这是一个事件,一大块代码,只要工作表发生变化就会执行。 Target是一个特殊变量,它将包含代码执行时更改的范围/单元格:

Private Sub Worksheet_Change(ByVal Target As Range)
    'Did something change in column J?
    If Not Intersect(Target, Range("J:J")) Is Nothing Then
        'Set the cell in Column F for the same row to nothing
        Range("F" & Target.Row).ClearContents
    End If
End Sub
© www.soinside.com 2019 - 2024. All rights reserved.