<p>参考</p><p>Sub test()<br/> Dim mUnion As Range<br/> Dim FirstAddress<br/> Dim Rng As Range<br/> Dim pt As Range</p><p> With Sheet1<br/> On Error GoTo ErrH<br/> Set Rng = .UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers)<br/> On Error GoTo 0<br/> <br/> Set pt = Rng.Find(0, MatchCase:=True, Lookat:=xlWhole)<br/> If Not pt Is Nothing Then<br/> FirstAddress = pt.Address<br/> Do<br/> If mUnion Is Nothing Then<br/> Set mUnion = pt<br/> Else<br/> Set mUnion = Union(mUnion, pt)<br/> End If<br/> Set pt = Rng.FindNext(pt)<br/> Loop While Not pt Is Nothing And pt.Address <> FirstAddress<br/> End If<br/> If mUnion Is Nothing Then Exit Sub<br/> mUnion.EntireRow.Select<br/> End With<br/> <br/> Exit Sub<br/>ErrH:<br/>End Sub</p>
[此贴子已经被作者于2007-4-3 15:42:06编辑过] |