I am trying to run a macro that makes all of the numeric cells in the used range (ie not the entire worksheet) have the format _(#,##0_)_%;(#,##0)_%;_("?"_)_%;_(@_)_%
But, it is not working. I am receiving an error code "unable to set number format property of the range class"
The code i am trying is below. Any thoughts on where i am going wrong?
Sub FormatNumericCells()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers).Cells
If Not IsDate(cell.Value) And Not cell.MergeCells Then
cell.NumberFormat = "_(#,##0_)_%"";""_(#,##0)_%"";""_(""?"")_%"";""_(@_)_%"
End If
Next cell
End Sub
Bookmarks