如何清除B列到G的每一行的内容?"删除"在K栏。
这是我的代码,但我不知道如何使用它
Set rng = Range("K3", Range("K1000").End(xlUp))
For Each cel In rng
If cel.Value = "Remove" Then
'ClearContents in column B to G for each row that has Remove in column K
End If
Next cel
答案 0 :(得分:2)
另:
With ActiveSheet
.Range(.Cells(cel.Row,2),.Cells(cel.row,7)).ClearContents
End with
答案 1 :(得分:0)
另一种方法是这样做:
With ActiveSheet
.Range(.Cells(cel.row,2),.Cells(cel.row,7)).clearcontents
end with
参考表格可以帮助您避免一些可能的错误 - https://msdn.microsoft.com/en-us/library/office/ff196273.aspx