在导出时,我的旧系统从带有TOTALS美元符号“ $”的行列中删除,并且不允许DATES转移到SHEET2中。我试图记录一个文本到列的过程以包括在vba脚本中,但是,Sheet1将所有数据正确地传输到Sheet2中,在脚本停止之前,两列将总计增加了一行;和“文本到列” VBA脚本没有按我要求的顺序执行。
Private Sub TextToColumn ()
Dim LastRow As Long
Dim SHEET2 As Worksheet
Dim Results As Worksheet
Set Results = Sheets("SHEET2")
LastRow = Results.Cells(Results.Rows.Count, "Z").End(xlUp).Row
Range("A15:A400").Copy
Results.Range("A" & LastRow + 2).PasteSpecial xlValues
Range("B15:B400").Copy
Results.Range("B" & LastRow + 2).PasteSpecial xlValues
Range("J15:J400").Copy
Results.Range("C" & LastRow + 2).PasteSpecial xlValues
Range("R15:R400").Copy
Results.Range("D" & LastRow + 2).PasteSpecial xlValues
Application.DataEntryMode = False
Dim lrow As Long
lrow = Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(2, 3), Cells(lrow, 2)).TextToColumns
Destination:=Range("C2"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, _
Semicolon:=True, FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
End Sub