Below is the final few lines of a long macro that to generate a sales file.
The file I export has a list of 10 digit numbers in column A, with the following code making the final read XXEND followed by a couple of blank lines.
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Application.Goto Cells(Rows.Count, "A").End(xlUp).Offset(1), Scroll:=True
ActiveCell.FormulaR1C1 = "XXEND"
Range("A1").Select
Application.Goto Cells(Rows.Count, "A").End(xlUp).Offset(2), Scroll:=True
ActiveCell.FormulaR1C1 = "'"
Range("A1").Select
ActiveWorkbook.SaveAs FileName:="/Users/LucasWayne/Desktop/Websales.txt", FileFormat:=xlText, CreateBackup:=False
Shell ("/Users/LucasWayne/Desktop/WebSalesToK4.app")
ActiveWorkbook.Close
End Sub
Sometimes my list has no values in column A, with XXEND being the only value in the entire workbook.
If that is the case, before XXEND would be inputted, if there are no values in column A, I would like to terminate the macro early, and instead just close the Excel file without saving.