[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 586"]
<colgroup><col width="257" style="width: 193pt; mso-width-source: userset; mso-width-alt: 9398;"> <col width="60" style="width: 45pt; mso-width-source: userset; mso-width-alt: 2194;"> <col width="98" style="width: 74pt; mso-width-source: userset; mso-width-alt: 3584;"> <col width="84" style="width: 63pt; mso-width-source: userset; mso-width-alt: 3072;"> <col width="86" style="width: 65pt; mso-width-source: userset; mso-width-alt: 3145;"> <col width="111" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4059;"> <col width="84" style="width: 63pt; mso-width-source: userset; mso-width-alt: 3072;"> <tbody>[TR]
[TD="class: xl69, width: 257, bgcolor: transparent"]Aliquot Number[/TD]
[TD="class: xl69, width: 60, bgcolor: transparent"]Analyte[/TD]
[TD="class: xl69, width: 98, bgcolor: transparent"]Measured Value[/TD]
[TD="class: xl69, width: 84, bgcolor: transparent"]Analysis Date[/TD]
[TD="class: xl69, width: 86, bgcolor: transparent"]Analysis Time[/TD]
[TD="class: xl69, width: 111, bgcolor: transparent"]Analyst[/TD]
[TD="class: xl69, width: 84, bgcolor: transparent"]Dilution factor[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12345[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]2.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12346[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]3.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12347[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]4.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12348[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]5.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12349[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]6.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12350[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]7.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12351[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]8.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12352[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]9.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12353[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]10.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12354[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]11.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12355[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]12.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12356[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]13.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12357[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]14.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12358[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]15.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12359[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]16.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have a worksheet above(Upload), which gets data from another worksheet (Batch) in the same workbook.
My vba code creates a csv file (code below) However, when the file is created, it creates a line for the rows that have nothing in column A.
How do I change my code to only select data if there is a 'character' in column A? For example, looking at the above table, I would only want the first 15 rows of data.
Sub WriteCSVTitanUpload()
Dim FilePath As String
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
LastCol = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column
LastRow = ActiveSheet.Range("A1").SpecialCells(xlCellTypeLastCell).Row
'LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row (I was trying different codes here)
CellData = ""
FilePath = "H:\Redirection\Documents\ATL Implementation\NH3Upload.csv"
Open FilePath For Output As #2
For i = 1 To LastRow
For J = 1 To LastCol
If J = LastCol Then
CellData = CellData + Trim(ActiveCell(i, J).Value)
Else
CellData = CellData + Trim(ActiveCell(i, J).Value) + ","
End If
Next J
Write #2, CellData
CellData = ""
Next i
Close #2
MsgBox ("Done")
End Sub
<tbody>[TR]
[TD][TABLE="width: 586"]
<colgroup><col width="257" style="width: 193pt; mso-width-source: userset; mso-width-alt: 9398;"> <col width="60" style="width: 45pt; mso-width-source: userset; mso-width-alt: 2194;"> <col width="98" style="width: 74pt; mso-width-source: userset; mso-width-alt: 3584;"> <col width="84" style="width: 63pt; mso-width-source: userset; mso-width-alt: 3072;"> <col width="86" style="width: 65pt; mso-width-source: userset; mso-width-alt: 3145;"> <col width="111" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4059;"> <col width="84" style="width: 63pt; mso-width-source: userset; mso-width-alt: 3072;"> <tbody>[TR]
[TD="class: xl69, width: 257, bgcolor: transparent"]Aliquot Number[/TD]
[TD="class: xl69, width: 60, bgcolor: transparent"]Analyte[/TD]
[TD="class: xl69, width: 98, bgcolor: transparent"]Measured Value[/TD]
[TD="class: xl69, width: 84, bgcolor: transparent"]Analysis Date[/TD]
[TD="class: xl69, width: 86, bgcolor: transparent"]Analysis Time[/TD]
[TD="class: xl69, width: 111, bgcolor: transparent"]Analyst[/TD]
[TD="class: xl69, width: 84, bgcolor: transparent"]Dilution factor[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12345[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]2.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12346[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]3.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12347[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]4.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12348[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]5.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12349[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]6.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12350[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]7.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12351[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]8.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12352[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]9.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12353[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]10.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12354[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]11.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12355[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]12.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12356[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]13.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12357[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]14.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12358[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]15.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent, align: right"]12359[/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]16.2[/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl67, bgcolor: transparent"]NH3 as N[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, bgcolor: transparent, align: right"]11/17/2016[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]13:00[/TD]
[TD="class: xl67, bgcolor: transparent"]Sarah[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have a worksheet above(Upload), which gets data from another worksheet (Batch) in the same workbook.
My vba code creates a csv file (code below) However, when the file is created, it creates a line for the rows that have nothing in column A.
How do I change my code to only select data if there is a 'character' in column A? For example, looking at the above table, I would only want the first 15 rows of data.
Sub WriteCSVTitanUpload()
Dim FilePath As String
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
LastCol = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column
LastRow = ActiveSheet.Range("A1").SpecialCells(xlCellTypeLastCell).Row
'LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row (I was trying different codes here)
CellData = ""
FilePath = "H:\Redirection\Documents\ATL Implementation\NH3Upload.csv"
Open FilePath For Output As #2
For i = 1 To LastRow
For J = 1 To LastCol
If J = LastCol Then
CellData = CellData + Trim(ActiveCell(i, J).Value)
Else
CellData = CellData + Trim(ActiveCell(i, J).Value) + ","
End If
Next J
Write #2, CellData
CellData = ""
Next i
Close #2
MsgBox ("Done")
End Sub