My issue:
I have a workbook, and within it, I have three different sheets. Sheet 1 is some data from a PDF-file, where I want to use my TextToColumns. Sheet 2 contains data from our financial database, whereas it is already split into cells. Sheet 3 compares the two sets of data, from Sheet 1 and Sheet 2.
The code I use to split text into columns
Dim sht, sht2, sht3 As Worksheet
Set sht = Sheets("PDF")
Set sht2 = Sheets("Finance")
Set sht3 = Sheets("Compare")
FindDate21 = sht.Range("1:1").Find("Bookkeeping Date", LookAt:=xlWhole).Address(False, False, xlA1)
DateSub = sht.Application.WorksheetFunction.Substitute(FindDate21, 1, "")
FindDateOffset = sht.Range(FindDate21).Offset(1, 0).Address(False, False, xlA1)
LastRowDateSub = sht.Cells(sht.Rows.Count, DateSub).End(xlUp).Row
rng1 = FindDateOffset & ":" & DateSub & LastRowDateSub
sht.Range(rng1).TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), _
Array(6, 1), Array(7, 1), Array(8, 1))
My question exactly:
At the time of writing, my data in Sheet 1 is perfect, but the data in Sheet 2 is ruined. From being inserted into 16 different columns, it is shortened down into 3 columns. How can I get the TextToColumns effect, to not interfere with the data I paste in Sheet 2? Can I reverse the effect of the TextToColumns, without reversing the effect it has had on the data in Sheet 1?