Quote:
Originally Posted by nmkhan3010
Above macro was running all the tables and document was stacked and mostly document was not responding error I realized it is due to more no of pages and tables in different-different formats
|
Well, you did tell me that:
Quote:
Originally Posted by nmkhan3010
All the tables will not have the same structres top row is the headings and last is the total for all the tables in a document and tables row and columns are vary from table to table and all the tables will have numbers only and denominated by "," "." and vice-versa
|
You can't expect the macro to work correctly if the tables have different formats from what you said.
Quote:
Originally Posted by nmkhan3010
Pink highlight indicates for non-numeric entries (#$%^&)
Green highlight indicates for repaired entries (it is repairing only when the number is with characters or special characters only 12&5 , 136%^)
|
Those are not the only conditions the macro would count as non-numeric, and the presence of $ or % does not necessarily mean the contents are non-numeric. $1,000.00 is numeric, as is 0.99%.
Quote:
Originally Posted by nmkhan3010
Newly added:
Green highlight indicates for repaired entries – only when one value is wrong in that column and get rectify suppose instead of 8 it is given as 3 - can we repaired this type of entries by matching with the total or same as repairing with character or special characters previously and suppose if there is more than two wrong numeric entries then it will comes in yellow color (I think it’s possible only one cell value is wrong in that column I hope so
|
That is not possible - only non-numeric entries can be repaired. It is impossible for the code to know that an 8 in a numeric entry should be a 3, or vice-versa.
As for the code -
Change:
For Each Tbl In ActiveDocument.Tables
to:
For Each Tbl In Selection.Tables
Change:
If Val <> CDbl(Str) Then
to:
If Format(Val, "0.00") <> Format(CDbl(Str), "0.00") Then
Insert:
Code:
Else
.HighlightColorIndex = wdGray25
after:
Code:
.HighlightColorIndex = wdYellow
End If