2017-05-07 4 views
2

クリアコンテンツK

例コードを実行する前に、 enter image description here

enter image description here

コードを実行した後ここに私のコードですが、私はメートルに使用するかわからないんだけどそれは動作します

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 

答えて

2

コードのその位置で使用できる多くのステートメントがあります。一つは、次のようになります。

cel.Offset(0, -9).Resize(1, 6).ClearContents 

もう一つは次のようになります。

cel.EntireRow.Range("B1:G1").ClearContents 
2

別:

With ActiveSheet 
    .Range(.Cells(cel.Row,2),.Cells(cel.row,7)).ClearContents 
End with 
+0

全く悪くありません! :) – Vityata