Q
| Problem | Makro |
| Quersumme ermitteln (mehrstellig) |
Sub Quersumme() Dim Zahl, Q Zahl = 99999 'mit Left, Right und Mid ermittelte Zahlen sind Text, 'deshalb müssen sie mit *1 zu Zahlen umgewandelt werden For x = 1 To Len(Zahl) Q = (Mid(Zahl, x, 1) * 1) + Q Next x MsgBox "Die Quersumme ist " & Q End Sub |
| absolute Quersumme ermitteln (einstellig) |
Sub absolute_Quersumme() Dim Zahl, Q Zahl = 12345 'mit Left, Right und Mid ermittelte Zahlen sind Text, 'deshalb müssen sie mit *1 zu Zahlen umgewandelt werden For x = 1 To Len(Zahl) Q = (Mid(Zahl, x, 1) * 1) + Q Next x For x = 1 To Len(Q) aQ = (Mid(Q, x, 1) * 1) + aQ Next x MsgBox "Die absolute Quersumme ist " & aQ End Sub |