Spaces while using "Print" in VBA
- by Josh
For some reason I am getting a lot of spaces in front of each value while trying to print to a flat text file.
'append headers
Cells(start_row - 2, 1).Select
For i = 1 To ActiveCell.SpecialCells(xlLastCell).Column
    If ActiveCell.Offset(0, 1).Column = ActiveCell.SpecialCells(xlLastCell).Column Then
        Print #finalCSV, Cells(start_row - 2, i) & "\n",
    Else
        Print #finalCSV, Cells(start_row - 2, i) & ",",
    End If
Next i
Example output:
DC Capacity:hi,             Resistive Capacity:lo,      Resistive Capacity:hi,      Reactive Capacity:lo,
Is there any way to get rid of these spaces?