![]() |
Rounding in vba
I have a number value copy from another worksheet to currect worksheet using
below statement. shtDemand.Cells(irow2, 2).Copy bkCheckbook.ActiveSheet.Cells(irow + 5, 3).PasteSpecial Paste:=xlPasteValues If value from shtDemand is 1008.5, I want it to be pasted as 1009. If it's 230.3, then I want it as 230 Roundup/down with no decimal. |
Rounding in vba
"choo" wrote:
If value from shtDemand is 1008.5, I want it to be pasted as 1009. If it's 230.3, then I want it as 230 bkCheckbook.ActiveSheet.Cells(irow + 5, 3) = _ WorksheetFunction.Round(shtDemand.Cells(irow2, 2),0) Note: I use WorksheetFunction.Round instead of the VBA Round function because the latter does "banker's rounding". VBA Round(1008.5,0) is 1008, not 1009. ----- original message ----- "choo" wrote in message ... I have a number value copy from another worksheet to currect worksheet using below statement. shtDemand.Cells(irow2, 2).Copy bkCheckbook.ActiveSheet.Cells(irow + 5, 3).PasteSpecial Paste:=xlPasteValues If value from shtDemand is 1008.5, I want it to be pasted as 1009. If it's 230.3, then I want it as 230 Roundup/down with no decimal. |
All times are GMT +1. The time now is 12:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com