View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Problem: Excel drops significant digits in copy value function...

Try:
Tools Options Edit

and clear the fixed decimal checkbox
--
Gary's Student


"MikeZz" wrote:

I know there are certainly more efficient ways of managing this data and
should be in a database but this is what I have to work with right now.

Basically, I am copying values from one sheet to an equivilant sheet over a
specified range of cells.

The problem is that the value in the original sheet can be say: "1.2345".
It's copied into the var: newvalue as "1.2345" but this is what happens:
Sheets(tosheet).Range(start_range).Offset(row, col).Value turns into: "1.23"

Excel or VBA rounds the value to 2 decimals and pastes the rounded value
into the new sheet. I need it to paste the actual value.

Thanks for the help!
MikeZz

Here's a copy of my Sub:
===================
Sub CopyDataFromSheetToSheet(row1, row2, col1, col2, fromsheet, tosheet,
start_range)
Dim row, newvalue, col
'This copies all non-locked cells from equivalent sheets.
For row = row1 To row2
For col = col1 To col2
If Sheets(tosheet).Range(start_range).Offset(row, col).Locked =
False Then
newvalue = Sheets(fromsheet).Range(start_range).Offset(row,
col).Value
Sheets(tosheet).Range(start_range).Offset(row, col).Value =
newvalue
End If
Next
Next
End Sub