#1
|
|||
|
|||
text result is too small hard to see
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 |
#2
|
||||
|
||||
The best way to handle this would be to create a simple userform with a label, which can be configured to display any font available at any practical size and use Paul's macros to write the result to the label caption instead of to the message box.
Import the userform from the attached zip file into the same template as the macro code and call it by changing both lines from Code:
MsgBox iTotal Code:
With frmCalculator .Caption = "Total" .lblResult.Caption = iTotal .lblResult.Font.Size = 24 .Show End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thank you very much, works great.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
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 |
searching a small text in a bigger text using VLOOKUP | Tesla | Excel | 6 | 04-05-2019 05:48 AM |
One Cell that controlls spread sheet result button to change simple fomula result | RAH | Excel Programming | 5 | 03-31-2018 04:52 PM |
Hard space in justified text | czytajsk | Word | 6 | 06-27-2012 05:03 PM |