+ Reply to Thread
Results 1 to 5 of 5

Change format of each cell in a column

  1. #1
    Registered User
    Join Date
    08-31-2015
    Location
    New York, USA
    MS-Off Ver
    2013
    Posts
    2

    Change format of each cell in a column

    Hi,
    first - letting you know that I am an IT person and had no idea how VBA works until today.
    So I need to change each cell format from 8/25/2015, etc (those are dates) to 08-25-2015
    Basically need to replace "/" with "-".
    I found this code and it works well but only for selected cell.

    With ActiveCell
    .NumberFormat = "@"
    ActiveCell.Value = Format(ActiveCell.Value, "mm") & "-" & Day(ActiveCell.Value) & "-" & "20" & Format(ActiveCell.Value, "yy")
    End With


    I need to apply this change to the whole Column (column might have different number of rows), so to the end of a column.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Change format of each cell in a column

    May be
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Change format of each cell in a column

    Hello,

    change the K to the column with the dates

    Please Login or Register  to view this content.
    Kind regards
    Leo

  4. #4
    Registered User
    Join Date
    08-31-2015
    Location
    New York, USA
    MS-Off Ver
    2013
    Posts
    2

    Re: Change format of each cell in a column

    Thanks, Leo. This worked perfectly.
    YasserKhalil is also good, but yours works better for my needs.
    Thanks again

  5. #5
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Change format of each cell in a column

    Nice, can you mark the case as solved ?


    Thanks
    Leo

+ 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. Show Error when a cell with number format change to date format
    By delroba in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2015, 02:57 AM
  2. Replies: 3
    Last Post: 02-24-2015, 02:58 AM
  3. [SOLVED] how do I format a column to change color when another column has a specific word in it?
    By officegirl14 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-23-2014, 06:15 PM
  4. Filter function doesn't change with column format change
    By sabrefan1970 in forum Excel General
    Replies: 0
    Last Post: 02-21-2014, 11:55 AM
  5. [SOLVED] Change Format of Column to Phone Format
    By basketball2524 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2013, 10:38 AM
  6. Change format of lots of data cell to a time format
    By dazza67 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-24-2013, 03:24 PM
  7. [SOLVED] Lock Cell Format - Allow copy and paste of data without format change
    By Chris12InKC in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2006, 12:50 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