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
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