Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-20-2020, 02:14 PM
macropod's Avatar
macropod macropod is offline Sum validation in ms word.. Windows 7 64bit Sum validation in ms word.. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by nmkhan3010 View Post
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 View Post
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 View Post
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 View Post
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
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum validation in ms word.. Abbreviations Validation - Word mrsandes Word VBA 17 04-16-2020 02:40 PM
Data Validation in Microsoft Word Template BradleyCase Word VBA 1 07-16-2019 12:37 PM
Sum validation in ms word.. Automate Job application word doc to Excel (with data validation) dylansmith Office 1 02-11-2018 12:58 PM
validation email address in word text filed sameerahmad_P Word VBA 1 03-07-2014 02:59 PM
Forms -with validation ubns Excel 1 05-04-2012 08:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft