|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test3()
Dim ar(), i&, r&, Rng As Range, n&, strRngText$
Application.ScreenUpdating = False
With ActiveDocument
With .Tables(2)
n = .Rows.Count
For i = 1 To n
strRngText = Left(.Cell(i, 1).Range.Text, Len(.Cell(i, 1).Range.Text) - 2)
If InStr(strRngText, "┈") Then
r = r + 1
ReDim Preserve ar(1 To 2, 1 To r)
ar(1, r) = Replace(strRngText, "┈", "")
ar(2, r) = i
End If
Next i
End With
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=3
For i = 1 To UBound(ar, 2)
With .Range(Selection.Start)
.Find.Execute FindText:=ar(1, i), Forward:=True
If .Find.Found = True Then
ActiveDocument.Tables(2).Cell(ar(2, i), 2).Range.Text = .Information(wdActiveEndPageNumber)
End If
End With
Next i
End With
Application.ScreenUpdating = True
Beep
End Sub
|
|