I am having trouble saving one sheet from my workbook into a CSV file. I have 18 sheets in the one workbook. Every time I run the macro, it saves a different sheet. I also need it so the display alerts do not pop up. I am a beginner to VBA and running macros, so any help would be appreciated.
Sub csvfile()
'
' csvfile Macro
'
'
ChDir "C:\Users\RM\Documents"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\RM\Documents\Working_Program\PSSE_Export_Data.csv", FileFormat:= _
xlCSV, CreateBackup:=False
Application.DisplayAlerts = False
End Sub
Application.DisplayAlerts = Falseneeds to go before the.SaveAs, not after.ActiveWorkbook.SaveAswill save the current active sheet. So make sure you've activated the sheet to save first.DisplayAlerts = Falsebefore the operation that might display the alerts instead of after. That's common sense. You can't shut the barn door after the horse has run off and expect it to magically put the horse back in the stall, can you?