Results 1 to 2 of 2

problems with formats in vba

Threaded View

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Lystrup, Denmark
    MS-Off Ver
    Excel 2003
    Posts
    0

    problems with formats in vba

    Hi for some reason my code inserts the wrong formatting when i copy from one sheet to another. The original format is fx 10,10 but comes out as 101.000

    the code i am using looks like:

    Sub hent_data()
    Application.DisplayAlerts = False
    
        Dim FileSys As FileSystemObject
        Dim objFile As File
        Dim myFolder
        Dim strFilename As String
        Dim dteFile As Date
    
        Sheets("Data").Select
        Cells.ClearContents
        
        ChDrive "o"
            
        ChDir "o:\Formuepleje\Morningstar data til ALMS"
          
        Const myDir As String = "o:\Formuepleje\Morningstar data til ALMS"
    
        Set FileSys = New FileSystemObject
        Set myFolder = FileSys.GetFolder(myDir)
    
        dteFile = DateSerial(1900, 1, 1)
        For Each objFile In myFolder.Files
            If objFile.DateCreated > dteFile Then
                dteFile = objFile.DateCreated
                strFilename = objFile.Name
            End If
        Next objFile
        Workbooks.Open strFilename
    
        Set FileSys = Nothing
        Set myFolder = Nothing
        
        Cells.Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveWorkbook.Close True
        Windows("Region og industri.xlsm").Activate
        Sheets("Data").Activate
        
      
         
        Range("A1").Select
    
        
        
        Sheets("Andele og graf").Select
        Application.CutCopyMode = False
            
        test_data_stemmer
        
        MsgBox ("Data er nu opdateret")
        
    End Sub
    Can you guys help me with this?

    Moderator's Edit: Use code tags when posting code.
    Last edited by arlu1201; 01-14-2013 at 09:15 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