Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 07-18-2021, 04:24 PM
Guessed's Avatar
Guessed Guessed is offline gematria calculator Windows 10 gematria calculator Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Is every paragraph in the document an equation? If not, how are the equations to be identified?


How do you want the result to appear? As a Comment or perhaps append '= x' to the end
Is there always a minus sign in the equation or is it sometimes just a straight addition task?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #17  
Old 07-18-2021, 10:52 PM
yacov yacov is offline gematria calculator Windows 10 gematria calculator Office 2016
Competent Performer
gematria calculator
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default

There are 3 types of paragraphs as described in file A. a paragraph with a minus (red),a paragraph with a plus (green), and a paragraph that is just a sentence (blue). All paragraphs have the sign = followed by a result (which I calculated manually) and which I need to check. and additional text (yellow) can be ignored.

2. In order to facilitate the test I created a new file for the test, and added after the mark = paragraph mark. (File B). So I was left with clean equations for calculation and additional text that is not important to me for the purpose of the test.

3. The situation at the moment is that I go through the document and check with the help of the macro the relevant paragraphs (and ignore the paragraphs that contain the additional text). Is it possible that the software will record the result next to each paragraph and so I will only have to go through the file and make sure that the calculation result of the macro is the same as the calculation I did manually. (File 3).
Thanks a lot,
Attached Images
File Type: jpg A.jpg (109.5 KB, 10 views)
File Type: jpg B.jpg (161.2 KB, 10 views)
File Type: jpg C.jpg (136.6 KB, 9 views)
File Type: jpg ORIGINAL DOC.jpg (128.8 KB, 10 views)
Reply With Quote
  #18  
Old 07-19-2021, 12:32 AM
Guessed's Avatar
Guessed Guessed is offline gematria calculator Windows 10 gematria calculator Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Assuming the paragraphs you want calculated all end with an equal sign, this will add the value after that character.
Code:
Sub MyCalculatorAll()
  Dim aChar As Variant, aRng As Range, iTotal As Long, bFlip As Boolean, aPara As Paragraph
  
  For Each aPara In ActiveDocument.Paragraphs
    Set aRng = aPara.Range
    aRng.End = aRng.End - 1
    'aRng.Select   'activate this line to see the progress or testing
    If aRng.Characters.Last = "=" Then
      iTotal = 0
      bFlip = False
      For Each aChar In aRng.Characters
        Select Case AscW(aChar)
          Case 1488 To 1497: iTotal = iTotal + AscW(aChar) - 1487
          Case 1498, 1499: iTotal = iTotal + 20
          Case 1500: iTotal = iTotal + 30
          Case 1501, 1502: iTotal = iTotal + 40
          Case 1503, 1504: iTotal = iTotal + 50
          Case 1505: iTotal = iTotal + 60
          Case 1506: iTotal = iTotal + 70
          Case 1507, 1508: iTotal = iTotal + 80
          Case 1509, 1510: iTotal = iTotal + 90
          Case 1511: iTotal = iTotal + 100
          Case 1512: iTotal = iTotal + 200
          Case 1513: iTotal = iTotal + 300
          Case 1514: iTotal = iTotal + 400
          Case 45: iTotal = iTotal * -1: bFlip = True 'a minus sign
        End Select
      Next aChar
      If bFlip Then iTotal = iTotal * -1
      aRng.InsertAfter iTotal
    End If
  Next aPara
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #19  
Old 07-19-2021, 01:25 AM
yacov yacov is offline gematria calculator Windows 10 gematria calculator Office 2016
Competent Performer
gematria calculator
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default

works great, God bless you.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Draft - Retirement Calculator DJ0691 Excel 0 01-16-2020 06:56 AM
gematria calculator Calculator in word Zhibek Word 2 08-17-2018 12:07 AM
gematria calculator Result Calculator Raza Excel Programming 7 01-26-2015 11:35 PM
Excel Calculator Mandusin Excel 6 12-25-2010 07:34 AM
Age Calculator in MS Outlook 2002 SP3 turns Outlook 0 06-15-2010 12:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:32 AM.


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