+ Reply to Thread
Results 1 to 7 of 7

Changing dates to text using VBA & deleting a column

  1. #1
    Registered User
    Join Date
    04-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Changing dates to text using VBA & deleting a column

    Hi.
    I have a problem that I want to use VBA to solve but I'm still learning VBA and can't figure it out.
    So the problem is:
    I have a column of variable length (rows) of dates (example "3/14/2012") which must be altered to the following format: 20120314. Secondly this number must then be converted to text.

    I've tried manipulating a recorded macro, but no luck.
    Hoping someone with more insight can help me out?
    I've attached an example sheet.

    Thank you advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Changing dates to text using VBA & deleting a column

    Columns("B").NumberFormat = "@" ?

  3. #3
    Registered User
    Join Date
    04-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing dates to text using VBA & deleting a column

    I am afraid I do not understand your response?

  4. #4
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Changing dates to text using VBA & deleting a column

    Below is some code that should get you started. It's not very elegant (I suspect there's a simpler way) but it will do the job.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Changing dates to text using VBA & deleting a column

    Perhaps:

    Please Login or Register  to view this content.
    For testing your Regular Expression patterns, try my Regular Expression Pattern Testing add-in!

    For notes on how to use it - see here.

  6. #6
    Registered User
    Join Date
    04-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing dates to text using VBA & deleting a column

    I'll give these a go, thanks!

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing dates to text using VBA & deleting a column

    Works perfectly! Thank you very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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