I want to copy data from excel to. Below is how I want to copy the data. For example I want to copy data in cell D4 of excel to A4 in csv.
"Excel ---> CSV "D4-->A4 "F4&all excluding the first character in G4-->B4 "K4-->E4 "L4-->F4 "N4-->G4 "P4-->I4 Below is my code. It creates and populates the data as I need except that it does not delete the first character in G4 when copying to B4 in csv. Can someone tell me how i need to change my code to implement this.
Sub csvfile() Dim fs As Object Dim a As Object Dim lngRow As Long Dim X Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("C:\temp\" & Environ("username") & ".csv", True) X = Range([d4], Cells(Rows.Count, "P").End(xlUp)).Value2 For lngRow = 1 To UBound(X) - 15 a.writeline X(lngRow, 1) & "," & X(lngRow, 3) & X(lngRow, 4) & ",,," & X(lngRow, 8) & "," & X(lngRow, 9) & "," & X(lngRow, 11) & ",," & X(lngRow, 13) Next a.Close End Sub