我在数据导入方面遇到问题。我正在使用以下代码从另一个CSV导入数据。
Sub Import(ByVal sFileName As String)
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim Sheet As Worksheet
Dim PasteStart As Range
Set wb1 = ActiveWorkbook
Set PasteStart = [DATA!A1]
'Clean Data Sheet
Sheets("DATA").Select
Cells.Select
Selection.ClearContents
If IsEmpty(sFileName) Then
MsgBox "No File Specified.", vbExclamation, "ERROR"
Exit Sub
Else
Set wb2 = Workbooks.Open(Filename:=sFileName, Delimiter:=";")
For Each Sheet In wb2.Sheets
With Sheet.UsedRange
.Copy PasteStart
Set PasteStart = PasteStart.Offset(.Rows.Count)
End With
Next Sheet
End If
wb2.Close
'Text to Column if needed
Call TextToColumnSemiToComa
'Activate Home Sheet
Worksheets("Netherland DCA").Activate
'Complete message
MsgBox ("Data Import Complete")
End Sub
问题是宏更改日期。对于前。原始文件具有12/10/2019(dd / mm / yyyy),但导入后为10/12/2019(dd / mm / yyyy)。你知道哪里可能出问题吗?