1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

copy/paste in excel macro changes cell format

Discussion in 'Business Applications' started by birdstill1, Dec 10, 2010.

Thread Status:
Not open for further replies.
  1. birdstill1

    birdstill1 Thread Starter

    Joined:
    Dec 10, 2010
    Messages:
    2
    update on the below question:I think something is wrong when I opened the .csv file.If I leave the file open then run the macro, it works ok. If I open the file within the macro, I get the format problem.Any advice?Thanks!Hi,

    Please can someone give me some advice on this?

    I am writing a vba code in Excel 2003 to copy from a source .csv file and paste into xls file.

    First, I tried this using macro recording, it worked fine. so I recorded the macro and tried to apply it. Something strange happened.

    One of the columns is date, and originally is format Date (*01/01/01). If I manually copy and paste, the format is fine. If I use the macro, some (and only some) of the cells in this column will change format to General and align to the right, while the others keep the original Date format and align to the left.

    How did this happen?

    I viewed the .csv file using Notepad, and cannot see any difference between these dates that end up in different format.
    And if I manually copy/paste, there will be no format issue at all.

    Please can someone help?

    Thanks!
     
  2. birdstill1

    birdstill1 Thread Starter

    Joined:
    Dec 10, 2010
    Messages:
    2
    upon a closer look, i think I found some clue, but still far from a solution, here is what I observed.

    for date 09/07/2006, excel interpret it as Sept 07 06
    for date 20/06/2012, excel interpret it as June 20 2012

    please note the year format is different!

    any advice pls?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/967620

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice