Home |
Search |
Today's Posts |
#1
|
|||
|
|||
counting rows of a given table
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 |
#2
|
|||
|
|||
Are you looking for something like:
For i = 1 To ActiveDocument.Tables(1).Rows.Count |
#3
|
|||
|
|||
Perfect! Thank you so much Greg!
You saved many hours of working time! Hope we have contact again, BR, Oliver "Greg" wrote: Are you looking for something like: For i = 1 To ActiveDocument.Tables(1).Rows.Count |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table headers/footers and layout | Page Layout | |||
Table AutoFormats vs. Table Styles confusion | Tables | |||
2002 Word Table Rows | Tables | |||
ALT+SHIFT+Arrow shortcut to move table rows | Tables | |||
Remove Rows from a Table after merging | Mailmerge |