View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default VBA Code to Round Range & Not Exceed 100

Hi Connor,

Am Wed, 22 Apr 2015 07:28:46 -0700 (PDT) schrieb Conor Finnegan:

I've got a file with roughly 100 rows of data in about 15 columns. For each row, I've got two ranges (one 10 columns) and another (5) columns that have %'s totaling 100% for each of the ranges.

I know I can use the round function to ROUND the range, but then I occasionally get a number when I sum that range greater than 100 or less than 100. Is there is a VBA code to check each of the ranges, round the values to 0 decimal places, but not exceed 100. I'm not against adding/subtracting from the largest value in that range. Then when done, move on to the next row through the bottom of the sheet.


format your cells custom with % without decimals
0%
Then no decimals are displayed but the values and the sum are correct


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional