我需要帮助使用VBA编程宏来删除“T& U”列中基于等于“已关闭”的列“N”的所有值。
所以为了简化这一点:如果列“N”=已关闭,则列“T”和“U”应该没有值。
谢谢!
答案 0 :(得分:0)
试试这个:
Sub Clearer()
Dim i As Long
Dim w As Worksheet
Dim r As Range
Dim r1 As Long
Set w = Sheet1 'Set this to the (name) of the sheet.
Set r = w.UsedRange
r1 = r.Row
For i = r1 To r1 + r.Rows.Count - 1
If w.Cells(i, 14) = "Closed" Then w.Range(w.Cells(i, 20), w.Cells(i, 21)).ClearContents
Next i
MsgBox "Done!"
End Sub