tmd63
New Member
- Joined
- Feb 21, 2014
- Messages
- 40
- Office Version
- 2013
- 2003 or older
- Platform
- Windows
I open a text CSV file for import into a new workbook then copy the data out into my workbook!
But the copied data has merged 2 columns together and I cannot figure out why.
I open this new file from line 2 as line 1 is blank.
But why does the opened CSV file have XXXX in column A and R28 in column B but the copy in my workbook is column A only as XXXX[Tab]R28??
But the copied data has merged 2 columns together and I cannot figure out why.
VBA Code:
Workbooks.OpenText Filename:=MyFile, Origin:=xlMSDOS, StartRow:=2, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
LastRow = ActiveSheet.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
ActiveSheet.Range("A1:B" & LastRow).Select
Selection.Copy
Application.DisplayAlerts = False
ActiveWorkbook.Close
Worksheets("CSV").Select
ActiveSheet.Range("A1:B" & LastRow).Select
Worksheets("CSV").PasteSpecial
I open this new file from line 2 as line 1 is blank.
But why does the opened CSV file have XXXX in column A and R28 in column B but the copy in my workbook is column A only as XXXX[Tab]R28??