Forum Discussion
OwenRandy214
Mar 04, 2024Copper Contributor
Need an excel macro/script to populate static data fields in a csv worksheet
I have a csv excel worksheet that I have to produce daily from a data file, exported from a fuel recorder box. I recorded a micro/script in excel to produce this worksheet. When completed...
OwenRandy214
Copper Contributor
There wont be any blanks. The first macro works perfectly. I may have another question before I finish my macro.
Thanks for your help.
Randy
Thanks for your help.
Randy
OwenRandy214
Mar 07, 2024Copper Contributor
Steve,
Hello. I need to modify/edit my macro and need your help, please.
I have already modified it to "save" the converted workbook in the "csv" format to a specific folder. The file name remains the same each save and just overwrites.
But here is what i really need
1. to "save as" a specific file name to include the current date. Example "Owen-Promiles_3/6/2024" It could also contain the time, if needed.
2. Save to a folder called "Ready to Edit" which is on my desktop.
3. Then simply "exit" Excel
Thanks for your help.
Randy
Hello. I need to modify/edit my macro and need your help, please.
I have already modified it to "save" the converted workbook in the "csv" format to a specific folder. The file name remains the same each save and just overwrites.
But here is what i really need
1. to "save as" a specific file name to include the current date. Example "Owen-Promiles_3/6/2024" It could also contain the time, if needed.
2. Save to a folder called "Ready to Edit" which is on my desktop.
3. Then simply "exit" Excel
Thanks for your help.
Randy
- OwenRandy214Mar 07, 2024Copper Contributorhere is that part of my current macro
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("E3").Select
ActiveWorkbook.Save
Range("H3").Select
ChDir "C:\Users\rsrig\Desktop\New Fuel Box\Ready to Edit"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\rsrig\Desktop\New Fuel Box\Ready to Edit\Todays_Fuel_File_To Edit.csv" _
, FileFormat:=xlCSV, CreateBackup:=False
End Sub- Steve_SumProductComMar 07, 2024Iron ContributorYou can use Format(Now(), "yyyy-mm-dd"). Change the format code to suit your needs.
For example:
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\rsrig\Desktop\New Fuel Box\Ready to Edit\Todays_Fuel_File_To Edit" & Format(Now(), "yyyy-mm-dd") & ".csv" _
, FileFormat:=xlCSV, CreateBackup:=False- OwenRandy214Mar 07, 2024Copper ContributorThat works great, thanks