copying values

G

Guest

Suppose sheet1.A1 has value 0.00 displayed on worksheet. Hoewever, the value
"0" is stored in the formula box. When I execute the code below, it displays
"0" on sheet2.A1 instead of 0.00. How can I make this operation give me 0.00?

sheet2.cells(1,1).value = sheet1.cells(1,1).value
 
T

Tiah

sheet2.cells(1,1).Copy destination:=sheet1.cells(1,1)
or
after your line put
sheet2.cells(1,1).numberformat=sheet1.cells(1,1).numberformat
 
G

Guest

You need to set the number format something like this...

Sheet2.Cells(1, 1).Value = Sheet1.Cells(1, 1).Value
Sheet2.Cells(1, 1).NumberFormat = Sheet1.Cells(1, 1).NumberFormat
 
G

Guest

Add a second line of code like this:

sheet2.cells(1,1).value = sheet1.cells(1,1).value
sheet2.cells(1,1).NumberFormat = sheet1.cells(1,1).NumberFormat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top