René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

round [VBA]

option explicit

public sub round_()

  dim v as variant

  v = 54.4
' msgBox(round(v))

  if (round(v) <> v) then
    msgBox("round(" & v & ") <> " & v )
  else
    msgBox("round(" & v & ") = " & v )
  end if


  v = 54
' msgBox(round(v))

  if (round(v) <> v) then
    msgBox("round(" & v & ") <> " & v )
  else
    msgBox("round(" & v & ") = " & v )
  end if


  v="22"
  if (round(v) <> v) then
    msgBox("round(" & v & ") <> " & v )
  else
    msgBox("round(" & v & ") = " & v )
  end if

  if (round(cdbl(v)) <> cdbl(v)) then
    msgBox("round(" & v & ") <> " & v )
  else
    msgBox("round(" & v & ") = " & v )
  end if

end sub
See also other VBA stuff