在input时从单元格中删除0
我想要一个macros,当你input一个0
到一个特定的单元格/单元格区域,它清除单元格。
我写了这样一个简单的macros
Sub RemoveZeros() 'to remove 0 values that may be a result of a formula or direct entry. For Each cell In Range("A1:D20") If cell.Value = "0" Then cell.Clear Next End Sub
但是,在我input值来清除之后,我必须运行这个。 如果input0
我希望单元清除。 我该怎么做呢?
我find了解决scheme
Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Target.Value = 0 Then Target.ClearContents Application.EnableEvents = True End Sub
谢谢