Results 1 to 3 of 3

Formatting issue with dates

Threaded View

  1. #1
    Registered User
    Join Date
    01-22-2009
    Location
    Canterbury, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Formatting issue with dates

    Hi there

    having a problem with formatting
    column E
    this column contains dates(and times) when i open the csv file.
    these date's are changed to five digit numbers if i manually edit the format.

    but when i run the macro the highlighted line does not change this column(it does change every other column).
    the cells in this column become text such as 21.10.2008 15:56.
    which is then an issue as i need to filter them when they are number and ultimatly group them in a pivot table.

    i recorded the macro from what i was doing and then ran it.
    it does work when it is in the module for the vehicle event report.csv

    but when run from the other file(as shown below) it encounters this problem.

    please help
    I usually fix my own code but this has really stumped me.

    thanks
    Ash
    Sub import()
    '
    ' Macro1 Macro
    '
     
    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .DisplayAlerts = True
    End With
    Sheets("data").Select
    Columns("A:G").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    Cells.Select
    Selection.NumberFormat = "0.00"
     
    ChDir "C:\process\TCO Vehicle Events"
    Workbooks.Open Filename:="C:\process\TCO Vehicle Events\Vehicle Event Report.csv"
    Windows("Vehicle Event Report.csv").Activate
    Cells.NumberFormat = "0.00"
    Columns("A:A").Select
    Columns("C:C").Select
    Columns("D:E").Select
    Columns("E:M").Select
    Columns("A:H").Select
    Selection.Copy
    Windows("Event Summary Report.xlsm").Activate
    Sheets("data").Select
    Columns("A:A").Select
    ActiveSheet.Paste
     
    Columns("c:C").Select
    Selection.NumberFormat = "0.00"
     
    Range("c2").Select
     
    Do Until ActiveCell.Value = ""
     
    If ActiveCell.Value > 9999999 Then
    Selection.EntireRow.Delete
    Else
    ActiveCell.Offset(1, 0).Select
    End If
    Loop
    Columns("c:C").Select
    Selection.NumberFormat = "m/d/yyyy h:mm"
     
     
     
    Windows("Vehicle Event Report.csv").Activate
    ActiveWindow.Close
    Windows("Event Summary Report.xlsm").Activate
    Sheets("Table").Select
     
    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .DisplayAlerts = True
     
    End With
     
    End Sub
    Last edited by ashw1984; 01-23-2009 at 05:00 AM.

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