Results 1 to 23 of 23

Date Formatting Problems in VBA

Threaded View

Colin Vicary Date Formatting Problems in... 09-12-2007, 05:24 AM
MattShoreson works fine for me. What... 09-12-2007, 06:29 AM
Colin Vicary Thanks for that Matt ... 09-12-2007, 06:44 AM
MattShoreson so the original cells are... 09-12-2007, 06:59 AM
Colin Vicary Yes, that's correct. 09-12-2007, 06:59 AM
  1. #1
    Registered User
    Join Date
    06-10-2004
    MS-Off Ver
    Office 2003
    Posts
    70

    Date Formatting Problems in VBA

    Hello All

    Firstly, apologies for not wrapping the code below. The link in the forum rules to show me how to do it appears to be broken

    I'm struggling to change the format of some dates that are imported as text.

    In a previous request ...

    http://www.excelforum.com//showthrea...4&goto=newpost

    I was shown a way to convert dates correctly.

    This solution works perfectly when carried out manually, but doesn't work if a record a macro and then replay it - only some of the dates are converted.

    Here is a small sample of the dates I'm working with...

    04/09/2008
    05/10/2007
    08/10/2007
    14/09/2007
    15/09/2007
    17/09/2007
    17/09/2007
    17/09/2007
    19/03/2008
    20/09/2007
    21/09/2007
    21/09/2007
    25/09/2008
    27/09/2007
    28/09/2007
    28/09/2007

    And here's the recorded macro, deliberately left exactly as is

    Sub Macro3()
    '
    ' Macro3 Macro
    ' Macro recorded 12/09/2007 by 0008
    '
    
    '
        Range("B1").Select
        ActiveCell.FormulaR1C1 = "1"
        Range("B1").Select
        Selection.copy
        Range("A1:A16").Select
        Selection.PasteSpecial Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:= _
            False, Transpose:=False
        Application.CutCopyMode = False
        Selection.NumberFormat = "mm/dd/yyyy"
    End Sub
    Can anyone help please?

    Many thanks

    Colin
    Last edited by dominicb; 09-12-2007 at 05:36 AM.

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