![]() |
#1
|
|||
|
|||
![]()
Hi,
Attached below is a very useful macro written by Macropod and for that I want to thank him again. and ask if it is possible to increase the text size of the result in this macro. Also attached is a picture of the resulting text. Thanks a lot, Yacov Sub MyCalculatorSentences() Selection.Range.Sentences(1).Select 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 1498: iTotal = iTotal + 20 Case 1499: iTotal = iTotal + 20 Case 1500: iTotal = iTotal + 30 Case 1501: iTotal = iTotal + 40 Case 1502: iTotal = iTotal + 40 Case 1503: iTotal = iTotal + 50 Case 1504: iTotal = iTotal + 50 Case 1505: iTotal = iTotal + 60 Case 1506: iTotal = iTotal + 70 Case 1507: iTotal = iTotal + 80 Case 1508: iTotal = iTotal + 80 Case 1509: iTotal = iTotal + 90 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 Sub MyCalculatorOr() Selection.Range.Sentences(1).Select 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 1498: iTotal = iTotal + 20 Case 1499: iTotal = iTotal + 20 Case 1500: iTotal = iTotal + 30 Case 1501: iTotal = iTotal + 40 Case 1502: iTotal = iTotal + 40 Case 1503: iTotal = iTotal + 50 Case 1504: iTotal = iTotal + 50 Case 1505: iTotal = iTotal + 60 Case 1506: iTotal = iTotal + 70 Case 1507: iTotal = iTotal + 80 Case 1508: iTotal = iTotal + 80 Case 1509: iTotal = iTotal + 90 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 Case 47: iTotal = 0 'reset counter to zero if / encountered Case Else: Debug.Print AscW(aChar) 'show unhandled characters in Immediate Window End Select Next aChar MsgBox iTotal End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pulling data from MenaData and BioData in result sheet based on employee id and then result in resul | aligahk06 | Excel | 2 | 09-07-2019 02:23 PM |
Data Compare and result as true or false in result sheet | aligahk06 | Excel | 1 | 08-29-2019 06:44 AM |
![]() |
Tesla | Excel | 6 | 04-05-2019 05:48 AM |
![]() |
RAH | Excel Programming | 5 | 03-31-2018 04:52 PM |
![]() |
czytajsk | Word | 6 | 06-27-2012 05:03 PM |