O
OliverTwist
hi all,
i'm looking forward to find a possibility to select one table out of a known
number of tables in my document, and then i want to apply a macro to this
table.
e.g. my document consists of 14 tables an i want the macro to be applied to
table no. 12 using the following procedure:
Sub Verdict_Return_Oliver_Small_Template()
'
' Verdict_Return Macro
' Macro created 26/04/2005
'
ActiveWindow.ScrollIntoView Obj:=Selection.Range, Start:=True
For i = 2 To ActiveDocument.Tables(1).Rows.Count
Selection.Tables(1).Cell(i, 6).Select
LowerLimit = Selection.Calculate
Selection.Tables(1).Cell(i, 7).Select
UpperLimit = Selection.Calculate
Selection.Tables(1).Cell(i, 8).Select
Meas = Selection.Calculate
Selection.Tables(1).Cell(i, 9).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
i tried to replace the no "1" in "ActiveDocument.Tables(1).Rows.Count" by 13
but it didn't work.
does anyone know another solution or do i only make a small mistake?
thanks so far, this is one of the best newsgroups i ever saw an my small
procedure was already created with help of you all.
BR,
Oliver
i'm looking forward to find a possibility to select one table out of a known
number of tables in my document, and then i want to apply a macro to this
table.
e.g. my document consists of 14 tables an i want the macro to be applied to
table no. 12 using the following procedure:
Sub Verdict_Return_Oliver_Small_Template()
'
' Verdict_Return Macro
' Macro created 26/04/2005
'
ActiveWindow.ScrollIntoView Obj:=Selection.Range, Start:=True
For i = 2 To ActiveDocument.Tables(1).Rows.Count
Selection.Tables(1).Cell(i, 6).Select
LowerLimit = Selection.Calculate
Selection.Tables(1).Cell(i, 7).Select
UpperLimit = Selection.Calculate
Selection.Tables(1).Cell(i, 8).Select
Meas = Selection.Calculate
Selection.Tables(1).Cell(i, 9).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
i tried to replace the no "1" in "ActiveDocument.Tables(1).Rows.Count" by 13
but it didn't work.
does anyone know another solution or do i only make a small mistake?
thanks so far, this is one of the best newsgroups i ever saw an my small
procedure was already created with help of you all.
BR,
Oliver