+ Reply to Thread
Results 1 to 4 of 4

cell text formating after CopyFromRecordset

  1. #1
    Registered User
    Join Date
    11-12-2009
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    9

    cell text formating after CopyFromRecordset

    Dear all,

    I have write a vba code that can copy data from another excel spreadsheet.

    But i have a problem to display the information properly.

    Say example:

    original Excel:

    00001 (text format)
    00002
    00003
    00004

    after the VBA copyfrom recordset, it become:-

    1 (numeric format)
    2
    3
    4

    Below are the codes, any vba code i can convert it to TEXT format while in the process CopyFromRecordset?? Please advice.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: cell text formating after CopyFromRecordset

    Hi Darren

    The trick is to set the format of the target cell as Text prior to entering the data into it. Try the following:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,535

    Re: cell text formating after CopyFromRecordset

    If the values are truly text @ source (ie 0001 and not 1 formatted with leading zeroes to appear as 0001) then you could perhaps try amending

    Please Login or Register  to view this content.
    to:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-12-2009
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: cell text formating after CopyFromRecordset

    thank you so much. It help alot..

+ 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