View Single Post
 
Old 07-15-2021, 02:21 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
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

You can tidy it a tiny amount by combining some of the lines with the same output
For example, these two lines
Case 1498: iTotal = iTotal + 20
Case 1499: iTotal = iTotal + 20

can be written on one line as
Case 1498, 1499: iTotal = iTotal + 20

I don't think it would make any difference to the speed of the macro either way.

The maths is NOT likely to be right when there is a minus sign. It would certainly be wrong if there are two of them (eg a - b - c) since all I was doing was flipping the sign of the running total when the macro hits it. Unfortunately I don't know anything about right to left language equations so that is something you will need to solve if it bothers you.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote