+ Reply to Thread
Results 1 to 2 of 2

Macro to change the column formats

Hybrid View

toravietl Macro to change the column... 04-13-2014, 02:47 AM
RudiS Re: Macro to change the... 04-13-2014, 03:49 AM
  1. #1
    Registered User
    Join Date
    03-09-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    85

    Macro to change the column formats

    Hi,

    I have some data in two text files.I have copied textfile1 data into sheet1 and textfile2 data into sheet2.Both the sheets have same numberof columns with same data format each column.Some columns having timestamp and date values.when i use format painter to change the sheet2 format same like sheet1 forrmat for all the columns in sheet2 not changing properly some values are changing some values are not changing properly especially date and timestamp columns.I need macro that will change the columns formats of sheet2 same like sheet1.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Macro to change the column formats

    Hi,

    Your solution isn't really with the data...but with how you bring the text data into Excel. I will recommend that you *import* the data using the DATA ribbon, Get Text. This will trigger the Text Import Wizard which will allow you to import the data and have numbers and dates correctly translated. If you just copy and paste text data into Excel, Excel will not translate dates correctly and some dates might become text.

    See the image below...In step 3 you can specify a column and supply info as to General, Text, Date and Skip. Date columns should always be specified as date with the correct format (MDY, DMY, YMD, etc)

    Try importing the data again into a new workbook using this method...and you will see that your dates import nice and accurately.
    Attached Images Attached Images
    Regards,
    Rudi

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to Change Column Headers Depending on What Column is being Filtered
    By Stormm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2013, 05:34 PM
  2. Change date formats using a macro 01.23.11
    By SAP_hostage in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2011, 04:17 PM
  3. How to change multiple date formats in same column
    By muchado in forum Excel General
    Replies: 6
    Last Post: 11-10-2010, 01:37 AM
  4. Macro for Vlookup copy from one column to next one and change column reference
    By RajivShrivastav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2010, 06:39 PM
  5. [SOLVED] Copying formats - column widths, formats, outlining to worksheets
    By DavidBr318 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2005, 09:05 AM

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