I am using the below code to copy a specific range of data and paste the results into a txt file. However, when pasting additional quotes are being generated on the longer lines that are automatically wrapping to a new line. Is there a way to paste the range into the text file and ensure each cell is on one line only, and there are no additional quotes ?
Example of current output with line breaks that are not present in excel, data is in one cell that does not wrap:
"Account number|test account|{""TT"":3,""True"",""Dept"",""SubDept"",""Street""|test1"
Desired output on one line in txt file:
Account number|test account|{"TT":3,"True","Dept","SubDept","Street"|test1
sub Test()
Application.ScreenUpdating = False
Dim formulasheet As Worksheet
Dim copysheet As Worksheet
Dim num As Integer
Dim valuecolumn As Range, cell As Object
Dim copycolumn As Range
Dim i As Range
num = 0
Set formulasheet = ActiveWorkbook.Sheets("Upload Template")
Set copysheet = ActiveWorkbook.Sheets("Copy")
Set valuecolumn = formulasheet.Range("B:B")
Set copycolumn = formulasheet.Range("A:A")
copysheet.Cells.Clear
formulasheet.Select
For Each i In valuecolumn
If i.Value > 0 Then
i.Offset(0, -1).Copy
copysheet.Select
copysheet.Range("A1").End(xlUp).Offset(num, 0).PasteSpecial Paste:=xlPasteValues
num = num + 1
End If
Next i
If copysheet.Range("A1") = "" Then
MsgBox "No transaction amounts, please review."
Exit Sub
Else
copysheet.Select
copysheet.Range("A:A").Copy
End If
Shell "notepad.exe", vbNormalFocus
SendKeys "{NUMLOCK}^v
end sub