0
我將首先說我對編碼不太好。當其他單元格空白時刪除單元格VBA excell
我遇到的問題是當我在單元格「L」中刪除我的文本時,日期保留在單元格「J」中。如果「L」爲空,我如何使它自動刪除?基本上,如果「L」中的單元格爲空白,我希望「J」中的相應單元格爲空。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim L As Range, Inte As Range, r As Range
Set L = Range("L:L")
Set Inte = Intersect(L, Target)
If Inte Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Inte
ActiveSheet.Range("J" & r.Row).Value = Date
Next r
Application.EnableEvents = True
End Sub
謝謝你,完美的工作! – Jeremie
(@Jeremie - Hurray!如果你已經解決了這個問題,請將標記標記爲答案?你可以點擊帖子左邊的複選標記,在上/下箭頭下方) – BruceWayne