JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 558
- Office Version
- 365
- Platform
- Windows
Hi All,
I have an odd one. The purpose of the code is pull out the fastest runners, and then copy the data to another sheet.
The speeds are being pulled from a pivot table.
The pivot table has speeds with two decimal places - no drama.
If I do an = sign and refer to the pivot table cell, I still get two decimal places - no drama.
However, when I use this code, if the referenced cell is <16.5, the result is being rounded down to 16 and if the reference cell is above 16.5, the result is being rounded up to 17.
I thought it might have something to do with Floating points, but that was fruitless.
A msgbox directly after the Speed = .Range("GV" & ii).Value line shows the value has already been rounded.
Any ideas ????
I am stumped on what appears to be a very simple exercise.
Thanks in advance.
I have an odd one. The purpose of the code is pull out the fastest runners, and then copy the data to another sheet.
The speeds are being pulled from a pivot table.
The pivot table has speeds with two decimal places - no drama.
If I do an = sign and refer to the pivot table cell, I still get two decimal places - no drama.
However, when I use this code, if the referenced cell is <16.5, the result is being rounded down to 16 and if the reference cell is above 16.5, the result is being rounded up to 17.
I thought it might have something to do with Floating points, but that was fruitless.
A msgbox directly after the Speed = .Range("GV" & ii).Value line shows the value has already been rounded.
Any ideas ????
I am stumped on what appears to be a very simple exercise.
Thanks in advance.
VBA Code:
Sub FindFastest()
Dim Speed as Long, irow As Long, ii As Long
With Sheet1
For ii = 2 To 25
If .Range("GV" & ii).Value >= 16 Then
Speed = .Range("GV" & ii).Value
With Sheet34
'last row - need to find each time
irow = .Range("BA30").End(xlUp).Row + 1
.Range("BD" & irow).Value = Speed
End With
End If
Next
End With
End Sub