automatic rounded up value

khatri milan

New Member
Joined
Nov 6, 2019
Messages
17
i am using following vba code to put data from a table in one worksheet into another worksheet, it is working fine except that the value are geting rounded up to nearest integer(37.53 to 38.00).I checked its format too ,it is set for two points after decimal . why is it geting rounded up automatically? Is it because i have defined vaiable as long?

Dim dia As Long
Dim maxcap As Long
Dim m As Integer
Dim n As Integer
For m = 74 To 76
For n = 4 To 22
maxcap = Worksheets("9_Sling Data").Range("c" & n).Value
If maxcap > Range("i" & m).Value Then
Range("h" & m).Value = maxcap
dia = Worksheets("9_Sling Data").Range("i" & n).Value
Range("g" & m).Value = dia
Range("j" & m).Value = Round(Range("i" & m).Value / Range("h" & m).Value, 2)
Range("c" & m).Value = n
Exit For
Else
End If
Next n
Next m
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,105,930
Messages
5,508,171
Members
408,669
Latest member
AgsikapAko

This Week's Hot Topics

Top