Hi all,
I've created a couple of simple formatting macro's to make my life a little bit easier. One such code is simply to press the hotkey multiple times to get the same format, but with a different number of decimals. i.e:
If Selection.NumberFormat = "#,##0x_);(#,##0x);-x_)" Then
Selection.NumberFormat = "#,##0.0x_);(#,##0.0x);-x_)"
ElseIf Selection.NumberFormat = "#,##0.0x_);(#,##0.0x);-x_)" Then
Selection.NumberFormat = "#,##0.00x_);(#,##0.00x);-x_)"
Else
Selection.NumberFormat = "#,##0x_);(#,##0x);-x_)"
End If
The above code works great. However, when I try to do the same for %, it just gets stuck on the first (no decimals) format and won't change when I run the macro again:
If Selection.NumberFormat = "#,##0%_);(#,##0%);-%_)" Then
Selection.NumberFormat = "#,##0.0%_);(#,##0.0%);-%_)"
ElseIf Selection.NumberFormat = "#,##0.0%_);(#,##0.0%);-%_)" Then
Selection.NumberFormat = "#,##0.00%_);(#,##0.00%);-%_)"
Else
Selection.NumberFormat = "#,##0%_);(#,##0%);-%_)"
End If
Does anyone know why this is the case? As far as I can tell, the code is exactly the same, but for x replaced with %.
Thanks for your time.
Bookmarks