chandler1983
New Member
- Joined
- Jan 5, 2014
- Messages
- 10
Greetings!
I am trying to have this Macro export a CSV, works great, however I need it to stop if there is a blank on the A. Can anyone help?
I tried the endXLUP Up, but no avail..
Sub Export()
Dim wsOld As Worksheet
Dim wsNew As Worksheet
Set wsOld = ActiveSheet
lastrow = Range("A2:U1029").End(xlUp).Row
Set wsNew = Workbooks.Add(xlWorksheet).Sheets(1)
wsOld.Range("A2" + CStr(lastrow)).Copy wsNew.Range("A1")
Application.DisplayAlerts = False
With ActiveWorkbook
.SaveAs Filename:="Z:\SBM\OUTPUT\cs_inv_line.csv", FileFormat:=xlCSV
.Close
End With
Application.DisplayAlerts = True
End Sub
I am trying to have this Macro export a CSV, works great, however I need it to stop if there is a blank on the A. Can anyone help?
I tried the endXLUP Up, but no avail..
Sub Export()
Dim wsOld As Worksheet
Dim wsNew As Worksheet
Set wsOld = ActiveSheet
lastrow = Range("A2:U1029").End(xlUp).Row
Set wsNew = Workbooks.Add(xlWorksheet).Sheets(1)
wsOld.Range("A2" + CStr(lastrow)).Copy wsNew.Range("A1")
Application.DisplayAlerts = False
With ActiveWorkbook
.SaveAs Filename:="Z:\SBM\OUTPUT\cs_inv_line.csv", FileFormat:=xlCSV
.Close
End With
Application.DisplayAlerts = True
End Sub