+ Reply to Thread
Results 1 to 4 of 4

copying values

  1. #1
    tom
    Guest

    copying values

    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

  2. #2
    Tiah
    Guest

    Re: copying values

    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

    "tom" <[email protected]> a écrit dans le message de news:
    [email protected]...
    > 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




  3. #3
    Jim Thomlinson
    Guest

    RE: copying values

    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

    --
    HTH...

    Jim Thomlinson


    "tom" wrote:

    > 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


  4. #4
    Tom Ogilvy
    Guest

    RE: copying values

    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

    --
    Regards,
    Tom Ogilvy



    "tom" wrote:

    > 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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1