It's more a math question rather than vba.
But we don't have math forum, and there are a lot of members who know math better than me.
I need to find the smallest number that is greater than a given number and divisible by a variable.
Two examples:
CountOfRows=8
CurrentCount= 51
What is the first number that is greater than 51 and is divisable by 8? (NextCount=56)
CountOfRows=10
CurrentCount= 181
What is the first number that is greater than 181 and is divisable by 10? (NextCount=190)
I know I can use
NextCount = CountOfRows * (Roundup(CurrentCount/CountOfRows))
But I can not use RoundUp.
Int doesn't return correct result.
I can use mod. But I couldn't find a way around it.
Any suggestions?
Do you have a better way?
thanks
But we don't have math forum, and there are a lot of members who know math better than me.
I need to find the smallest number that is greater than a given number and divisible by a variable.
Two examples:
CountOfRows=8
CurrentCount= 51
What is the first number that is greater than 51 and is divisable by 8? (NextCount=56)
CountOfRows=10
CurrentCount= 181
What is the first number that is greater than 181 and is divisable by 10? (NextCount=190)
I know I can use
NextCount = CountOfRows * (Roundup(CurrentCount/CountOfRows))
But I can not use RoundUp.
Int doesn't return correct result.
I can use mod. But I couldn't find a way around it.
Any suggestions?
Do you have a better way?
thanks
Last edited: