Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH SunshineinFt.Myers[_2_] Excel Worksheet Functions 7 March 5th 09 06:41 PM
I need a formula with rounding up & rounding down to the nearest . Tony Kay Excel Worksheet Functions 3 May 29th 07 11:13 PM
Rounding Steve[_2_] Excel Worksheet Functions 3 February 28th 07 11:53 PM
Rounding Jeanette Excel Worksheet Functions 2 December 6th 05 07:43 PM
Worksheet rounding vs VBA rounding Simon Cleal Excel Programming 4 September 2nd 05 01:50 AM


All times are GMT +1. The time now is 06:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"