View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Craig Craig is offline
external usenet poster
 
Posts: 208
Default Putting decimal values in a cell.

I exported my Crosstab query from Access into Excel since the date ranges
vary and the end column has to be totalled up. I try using the NumberFormat:
See code below. The total cell does just rounds the number even though it
shows 2 decimal places.

'Add up the totals horizontally to get a sum amount.
For i = intDataStartRow To intRows
intValue = 0
For j = intDataStartCol To intCols
Cells(i, j).NumberFormat = "0.00"
intValue = Cells(i, j).Value + intValue
Next j 'Next column
Cells(i, j).NumberFormat = "0.00"
Cells(i, j).Value = intValue 'insert the sum now that we are done
with the column.
Cells(i, j).Font.Bold = True 'bold it
Next i 'Next row

Thanks in advance!!
From Access Guy