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.
Bookmarks