Forum Discussion
Steve_SumProductCom
Mar 04, 2024Iron Contributor
You can set the values in the ranges in D, E, and F by starting at C3 and using the following statements:
ActiveSheet.Range("c3", ActiveSheet.Range("c3").End(xlDown)).Offset(0, 1).Value = "KY"
ActiveSheet.Range("c3", ActiveSheet.Range("c3").End(xlDown)).Offset(0, 2).Value = "OWEN"
ActiveSheet.Range("c3", ActiveSheet.Range("c3").End(xlDown)).Offset(0, 3).Value = "RUSSELLVILLE"
This assumes that from C3 to the end of the rows, there will be no blanks in column C. If you have blanks, then this will only set the values in the top section before you hit a blank cell in column C.
If you have blanks, then you can use something like this:
ActiveSheet.Range("c3", ActiveSheet.Range("c" & ActiveSheet.Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Offset(0, 1).Value = "KY"
ActiveSheet.Range("c3", ActiveSheet.Range("c" & ActiveSheet.Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Offset(0, 2).Value = "OWEN"
ActiveSheet.Range("c3", ActiveSheet.Range("c" & ActiveSheet.Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Offset(0, 2).Value = "RUSSELLVILLE"
- OwenRandy214Mar 04, 2024Copper ContributorThere wont be any blanks. The first macro works perfectly. I may have another question before I finish my macro.
Thanks for your help.
Randy- OwenRandy214Mar 07, 2024Copper ContributorSteve,
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