没搞明白具体需求,以下代码在word运行,是将所有表的同一个项目的第一个测量的最大值找出来。
Sub test()
Dim d
Set d = CreateObject("Scripting.Dictionary")
For Each t In ThisDocument.Tables
r = t.Rows.Count
For i = 6 To r
s = t.Cell(i, 5).Range.Text
s = Left(s, Len(s) - 2)
n = Val(t.Cell(i, 7).Range.Text)
If d(s) < n Then d(s) = n
Next
Next
s = ""
For Each t In d.Keys
s = s & t & " " & d(t) & Chr(13)
Next
MsgBox s
End Sub
按你的意图自己改去吧,反正又不是好恼火