I'm new to the VBA world and have been unable to convert Dates to Quarters using VBA code. I have managed to autofill Column F with a date based on when the file is opened MM.DD.YYYY and would like to automate column F to convert to Quarter 1, Quarter 2, Quarter 3, Quarter 4. Not sure what VBA code to use as I know this can be done by hand with an excel code in each cell. Thanks for your insights and recommendations:
To populate Column F with todays date. This could be done better as it fills the spreadsheet when I only need it to go to the end of the records currently in spreadsheet
date_test = Now()
Range("F:F").Select
Range("F:F") = Format(date_test, "MM/DD/YYYY")
[/Code]
Because of the above is filling the spreadsheet with unwanted rows. This is the code I'm using to delete the unwanted empty rows based on a consistent column
On Error Resume Next
Columns("b").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Thanks for helping the lost.
CLCoop
To populate Column F with todays date. This could be done better as it fills the spreadsheet when I only need it to go to the end of the records currently in spreadsheet
date_test = Now()
Range("F:F").Select
Range("F:F") = Format(date_test, "MM/DD/YYYY")
[/Code]
Tried to use an auto place a formula in F hoping to convert date into a Quarter (when I run the macro it stays with the original date in the cell) We are on a fiscal year.
Range("F2:F2").Formula = "=""Quarter " & Int(Month(R2) + 2 / 3) - 1
Range("F2:F110").FillDown
[/Code]
Range("F2:F2").Formula = "=""Quarter " & Int(Month(R2) + 2 / 3) - 1
Range("F2:F110").FillDown
[/Code]
Because of the above is filling the spreadsheet with unwanted rows. This is the code I'm using to delete the unwanted empty rows based on a consistent column
On Error Resume Next
Columns("b").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
[/Code]
Thanks for helping the lost.
CLCoop