|
神一般的人儿,这是个新问题,如何可以找出表格中的最值。但是现在涉及到个新的棘手的问题,再确定最值后并确定最大值的地址,后输出相应的最值及相应其他值。具体要求上传文件里有,还请大家来看看解答!
- Sub Macro1()
- On Error Resume Next
- Dim i&, j%, k%, zf$, d, d2, d3
- Set wd = CreateObject("Word.Application")
- Set d = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- Set d3 = CreateObject("scripting.dictionary")
- s = 2
- With wd.Documents.Open(ThisWorkbook.Path & "\新数据.doc")
- For k = 1 To .Tables.Count
- If Application.Clean(.Tables(k).Cell(1, 1).Range) Like "*环境温度*" Then
- s = s + 1
- Cells(s, 1) = s - 2
- For i = 6 To .Tables(k).Rows.Count
- zf = Application.Clean(.Tables(k).Cell(i, 5).Range)
- For j = 7 To 11
- x = Val(Application.Clean(.Tables(k).Cell(i, j).Range))
- If zf = "E" Then d(x) = i
- If zf = "Seq" Then d2(x) = ""
- If zf = "H" Then d3(x) = ""
- Next
- Next
- Cells(s, 2) = Application.Max(d.keys)
- Cells(s, 3) = Application.Min(d.keys)
- Cells(s, 4) = Application.Max(d2.keys)
- Cells(s, 5) = Application.Min(d2.keys)
- Cells(s, 6) = Application.Max(d3.keys)
- Cells(s, 7) = Application.Min(d3.keys)
- n = d(Application.Max(d.keys))
- Cells(s, 8) = Application.Clean(.Tables(k).Cell(n, 2).Range)
- Cells(s, 9) = Application.Clean(.Tables(k).Cell(n, 3).Range)
- Cells(s, 10) = Application.Clean(.Tables(k).Cell(n, 4).Range)
- d.RemoveAll: d2.RemoveAll: d3.RemoveAll
- End If
- Next
- .Close False
- End With
- wd.Quit
- End Sub
复制代码
|
|