O
OliverTwist
hi all,
i'm using a log-analyzer tool of some measurements with output of those into
a word document creating a simple table.
i wrote a macro (with help of this newsgroup posts *g*) to make verdicts
over passed and failed tests.
I want to apply this macro to every row of the tables, but with varying
maesurements, the size of the table changes an i need something like a "row
counter" to implement in my macro to update my FOR x IN ... procedure.
here is my macro so far with constant row number "Table_Rows":
Sub Verdict_Return()
'
' Verdict_Return Macro
' Macro created 26/04/2005 by opgenrhe
'
ActiveWindow.ScrollIntoView Obj:=Selection.Range, Start:=True
Dim Table_Rows As Integer
Table_Rows = 4
For i = 1 To Table_Rows
Selection.Tables(1).Cell(i, 1).Select
Base = Selection.Calculate
Selection.Tables(1).Cell(i, 2).Select
Variance = Selection.Calculate
Selection.Tables(1).Cell(i, 3).Select
Meas = Selection.Calculate
UpperLimit = Base + Variance
LowerLimit = Base - Variance
Selection.Tables(1).Cell(i, 4).Select
If LowerLimit <= Meas And Meas <= UpperLimit Then
Selection.Font.Color = wdColorGreen
Selection.TypeText Text:="PASS"
Else: Selection.Font.Color = wdColorRed
Selection.TypeText Text:="FAIL"
End If
Next i
End Sub
Any help would be greatly appreciated.
Oliver
i'm using a log-analyzer tool of some measurements with output of those into
a word document creating a simple table.
i wrote a macro (with help of this newsgroup posts *g*) to make verdicts
over passed and failed tests.
I want to apply this macro to every row of the tables, but with varying
maesurements, the size of the table changes an i need something like a "row
counter" to implement in my macro to update my FOR x IN ... procedure.
here is my macro so far with constant row number "Table_Rows":
Sub Verdict_Return()
'
' Verdict_Return Macro
' Macro created 26/04/2005 by opgenrhe
'
ActiveWindow.ScrollIntoView Obj:=Selection.Range, Start:=True
Dim Table_Rows As Integer
Table_Rows = 4
For i = 1 To Table_Rows
Selection.Tables(1).Cell(i, 1).Select
Base = Selection.Calculate
Selection.Tables(1).Cell(i, 2).Select
Variance = Selection.Calculate
Selection.Tables(1).Cell(i, 3).Select
Meas = Selection.Calculate
UpperLimit = Base + Variance
LowerLimit = Base - Variance
Selection.Tables(1).Cell(i, 4).Select
If LowerLimit <= Meas And Meas <= UpperLimit Then
Selection.Font.Color = wdColorGreen
Selection.TypeText Text:="PASS"
Else: Selection.Font.Color = wdColorRed
Selection.TypeText Text:="FAIL"
End If
Next i
End Sub
Any help would be greatly appreciated.
Oliver