Sub Word表格篩選_較慢() '811.8203 '
Dim r As Row, i As Long, rng As Range, tb As Table, s, e
s = Timer
Application.ScreenUpdating = False
ThisDocument.ActiveWindow.Visible = False
x = "口"
Set tb = ThisDocument.Tables(1)
tb.Range.Font.Hidden = False
For Each r In tb.Rows
i = i + 1
If i > 1 Then '太慢: r.Index > 1 Then'
If InStr(r.Cells(2).Range, x) = 0 Then
' 'r.Range.Select''
r.Range.Font.Hidden = True
End If
' r.Range.Font.Hidden = False'
End If
Next
Application.ScreenUpdating = True
ThisDocument.ActiveWindow.Visible = True
e = Timer
Debug.Print e - s
MsgBox "done" & vbCr & e - s, vbInformation
End Sub
Sub Word表格篩選() '558.6016 '
Dim r As Row, i As Long, rng As Range, tb As Table, c As Cell, s, e
s = Timer
Application.ScreenUpdating = False
ThisDocument.ActiveWindow.Visible = False
x = "口"
Set tb = ThisDocument.Tables(1)
tb.Range.Font.Hidden = False
For Each c In tb.Columns(2).Cells
i = i + 1
If i > 1 Then '太慢: r.Index > 1 Then'
If InStr(c.Range, x) = 0 Then
' 'r.Range.Select''
c.Row.Range.Font.Hidden = True '隱藏的文字range=""'
End If
' r.Range.Font.Hidden = False'
End If
Next
Application.ScreenUpdating = True
ThisDocument.ActiveWindow.Visible = True
e = Timer
Debug.Print e - s
MsgBox "done" & vbCr & e - s, vbInformation
End Sub