2012-02-09 64 views

回答

2

试试这个:

With Intersect(Columns("G:G"), ActiveSheet.UsedRange) 
    If WorksheetFunction.CountBlank(.Cells) > 0 Then 
     .SpecialCells(xlCellTypeBlanks).Offset(, -6).ClearContents 
    End If 
End With 
+0

+1不错的使用COUNTBLANK而不是标准的错误检查 – brettdj 2012-02-09 00:37:13

0

试试这个。

Columns("G:G").SpecialCells(xlCellTypeBlanks).Offset(0,-6).ClearContents 
0

像这样:

On Error Resume Next  ' In case there are no blanks 
Columns("G:G").SpecialCells(xlCellTypeBlanks).Offset(, -6) = "" 
+1

如果你要诉诸错误处理(出错时继续下一步),不要忘了之后重置(On Error转到0) – Reafidy 2012-02-09 00:27:44

相关问题