I'm trying to paste copied data from a csv file into Excel. When pasting the data, I need to skip a good portion of the columns that are included in the data. To this end, I've tried using FieldInfo with Text to Columns to create an array. I actually had success using this code 2 times. The columns that I wanted to skip (data type 9) were not imported and all the other columns were imported into my Excel sheet. For some reason, it doesn't seem to work anymore, so perhaps i made a minute change or I'm missing a small detail.
When running this code, the first column is skipped and not imported, but then all subsequent columns are imported. I've researched questions on this site and many others. I can't figure it out.
Any help is appreciated. Thanks in advance!
Here is the code I'm using:
Sub Test_PasteParsing()
With ThisWorkbook.Sheets(1)
Range("A1").PasteSpecial
End With
Columns("A:A").TextToColumns _
Destination:=Range("A1"), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:=False, _
FieldInfo:=Array(Array(1, 9), Array(2, 9), Array(3, 4), Array(4, 2), Array(5, 9), Array(6, 9), _
Array(7, 9), Array(8, 2), Array(9, 9), Array(10, 9), Array(11, 2), Array(12, 9), _
Array(13, 2), Array(14, 9), Array(15, 9), Array(16, 2), Array(17, 9), Array(18, 9), _
Array(19, 9), Array(20, 9), Array(21, 9), Array(22, 9), Array(23, 9), Array(24, 9), _
Array(25, 9), Array(26, 9), Array(27, 9), Array(28, 2), Array(29, 2), Array(30, 2), _
Array(31, 2), Array(32, 9), Array(33, 9), Array(34, 9), Array(35, 9), Array(36, 9), _
Array(37, 9), Array(38, 2), Array(39, 9), Array(40, 2), Array(41, 9), Array(42, 9), _
Array(43, 9), Array(44, 9), Array(45, 9), Array(46, 9), Array(47, 9), Array(48, 9), _
Array(49, 9), Array(50, 9), Array(51, 2), Array(52, 2), Array(53, 2), Array(54, 2), _
Array(55, 9), Array(56, 9), Array(57, 2), Array(58, 9), Array(59, 2), Array(60, 9), _
Array(61, 9), Array(62, 2), Array(63, 9), Array(64, 9), Array(65, 2), Array(66, 2)), _
TrailingMinusNumbers:=True
End Sub