Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 07-14-2021, 06:36 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: 4,185
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

I don't know how to correctly handle the minus sign (is b-a the same as a-b in hebrew LTR and english RTL) or the spaces but this should be enough to get you started
Code:
Sub MyCalculator()
  Dim aChar As Variant, aRng As Range, iTotal As Long
  Set aRng = Selection.Range
  For Each aChar In aRng.Characters
    Select Case AscW(aChar)
      Case 1488 To 1497: iTotal = iTotal + AscW(aChar) - 1487
      Case 1499: iTotal = iTotal + 20
      Case 1500: iTotal = iTotal + 30
      Case 1502: iTotal = iTotal + 40
      Case 1504: iTotal = iTotal + 50
      Case 1505: iTotal = iTotal + 60
      Case 1506: iTotal = iTotal + 70
      Case 1508: iTotal = iTotal + 80
      Case 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     'a minus sign
    End Select
  Next aChar
  MsgBox iTotal
End Sub
I needed to convert the characters to their AscW ids to do this. This is the code I used to build that list when I selected your legend code.
Code:
Sub GetAscWFromLegend()
  Dim arr() As String, i As Integer, aRng As Range
  Set aRng = Selection.Range
  arr = Split(aRng.Text, " ")
  For i = LBound(arr) To UBound(arr)
    Debug.Print AscW(arr(i)), Mid(arr(i), 3)
  Next i
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



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 07:42 AM.


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