B
Brian A
I recorded a macro which sorts a column of dates selects the first date and
the end date and runs the Days360 excel function and divides that by 7 to get
the number fo weeks. I am trying to modify this macro because when I recorded
the macro it selected the exact cell of that particular data set. However,
each data set may have a different cell as the second date. So now I have
figured out how to select the last cell but I cant firgure out how to put
this in my Days360 function. I have pasted my code below. This code is giving
me an error. Plus it needs to be cleaned up because I have alot of useless
mouse clicks.
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Delete Shift:=xlUp
Cells.Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("F1").Select
ActiveCell.FormulaR1C1 = Application.Days360(Range(ActiveCell,
ActiveCell.End(xlDown)).Select) / 7
Range("F1").Select
Selection.NumberFormat = "0"
ActiveWorkbook.Save
the end date and runs the Days360 excel function and divides that by 7 to get
the number fo weeks. I am trying to modify this macro because when I recorded
the macro it selected the exact cell of that particular data set. However,
each data set may have a different cell as the second date. So now I have
figured out how to select the last cell but I cant firgure out how to put
this in my Days360 function. I have pasted my code below. This code is giving
me an error. Plus it needs to be cleaned up because I have alot of useless
mouse clicks.
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Delete Shift:=xlUp
Cells.Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("F1").Select
ActiveCell.FormulaR1C1 = Application.Days360(Range(ActiveCell,
ActiveCell.End(xlDown)).Select) / 7
Range("F1").Select
Selection.NumberFormat = "0"
ActiveWorkbook.Save