Thread: Copying Cells
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] horkuang@horkuang.com is offline
external usenet poster
 
Posts: 8
Default Copying Cells

Dave,
That makes sense to me.
Using .Copy, you are passing all the info on that cell; .value,
formatting, borders etc because you are effectively passing a Range
object.

With "Cells(1, 3) = Cells(1, 1)", you are only setting the default
property (.Value); there is no other information involved.

Without the formatting, the 2 methods then produce the same results.

NickHK

Dave Unger wrote:
Hello,

I'm using Excel 97

Maybe someone can explain this to me. I'm copying, via code, the
contents of one cell to another cell. The source cell contains a 16
decimal place number, and is formatted as currency with 4 decimal
places. (0.0160690694272642 stored, $0.0161 displayed).

With code Cells(1, 1).Copy Cells(1,3), I end up with the complete
number copied, and $0.0161 displayed. But Cells(1, 3) = Cells(1, 1)
only copies the 0.0161. However, if I remove the formatting from the
source cell, both methods produce the same result, and copy the
complete number. I haven't run into this one before. I thought the 2
methods were equivalent, but apparently not all the time.

Appreciate your help,

Regards,

DaveU