2015-08-15 127 views

回答

1
Option Explicit 

Public Sub filterBlanks() 

    With ActiveSheet.UsedRange 

     .AutoFilter Field:=2, Criteria1:="=" 

     .Columns(1).SpecialCells(xlCellTypeVisible).Select 

    End With 

End Sub 
1

使用Range.SpecialCells method找到列B兴田空白,然后Range.Offset property从A列中选择它们的相应细胞

with activesheet 
    with .columns("B").specialcells(xlcelltypeblanks) 
     with .offset(0, -1) 
      .select 'do something with the cells in column A 
     end with 
    end with 
end with 

上面可能会有问题,如果你有细胞跨列合并和B(例如A1:B1合并)。这也取决于细胞真正的空白;不是带有返回零长度字符串的公式的单元格(它们不是空白单元格)。

+0

谢谢Jeeped。完美的作品。 – Chuchoo

+0

[很高兴你整理出来了](http://stackoverflow.com/help/someone-answers)。 – Jeeped

相关问题