K
Kenneth E. Coakley
I've created a macro that inserts a formula in my current cell and then
formats the result. The macro looks like this:
ActiveCell.FormulaR1C1 = "=COUNT(C[1])/COUNT(A:A)"
ActiveCell.Select
Selection.NumberFormat = "0.0%"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Upon executing the macro, a "#DIV/0!" results even though the included
columns are properly filled with numeric values. In fact, if I simply select
the cell, put my insertion point in the formula bar and then click the green
check mark, the correct value appears even though nothing has changed.
What am I doing wrong?
Thanks for any help!
Ken
formats the result. The macro looks like this:
ActiveCell.FormulaR1C1 = "=COUNT(C[1])/COUNT(A:A)"
ActiveCell.Select
Selection.NumberFormat = "0.0%"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Upon executing the macro, a "#DIV/0!" results even though the included
columns are properly filled with numeric values. In fact, if I simply select
the cell, put my insertion point in the formula bar and then click the green
check mark, the correct value appears even though nothing has changed.
What am I doing wrong?
Thanks for any help!
Ken