VB - Divide integers doesn't include commas?

Your result variables is an integer If you work with doubles instead you will get 2.752 etc - which can be rounded using dbDivided = Round(lngFull / lngLow, 2) variables updated to be more meaningful Sub redone() Dim lngFull As Long Dim lngLow As Long Dim dbDivided As Double lngFull = 278 lngLow = 101 dbDivided = Round(lngFull / lngLow, 2) End Sub.

And that was it! Thanks! I should have guessed this really.. Something tells me this is pretty basic Visual Basic :) Thanx!

– Kenny Bones Oct 28 at 10:39 1 Dim intFull As Integer, intLow As Integer, dblDivided As Double works correctly. Unlike, for example, Java (where int/int produces an int result,) Integer/Integer does not always produce an Integer result in VBA - it depends on the type of variable that the result is assigned to. Also, Dim intFull, intLow, intDivided As Double gives us two Variant variables and one Double variable.

Finally, a Double variable with a name prepended with int is just going to lead to confusion – barrowc Oct 30 at 0:11 @barrowc. Agree on naming convention and have updated accordingly, Long being more efficient than Integer. Also have updated the variants which while workable is untidy, I should have run my standard single line dimensioning style.

Thanks for comments. – brettdj Oct 30 at 0:54.

Hmm, I've tried both / and \ now. When I use /, I get a value of 3. When I use \ I get a value of 2.

– Kenny Bones Oct 28 at 10:36 see above. The main issue was your variable type. The secondary issues was the backslash which Joachim identified.

Both are fixed in my post – brettdj Oct 28 at 10:41 +1 for posting first on the backslash remainder discard issue. – brettdj Oct 28 at 10:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions