Dim r As Range
For Each r In Sheets("Sheet2").UsedRange
If IsNumeric(r.Value) Then
If Abs(r.Value) < 1000 Then
r.NumberFormat = "#,###.###, ;(#,###.###,);-;"
Else
r.NumberFormat = "#,###, ;(#,###,);text;"
End If
Else
r.NumberFormat = "General"
End If
Next
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
For Each r In Target
If IsNumeric(r.Value) Then
If Abs(r.Value) < 1000 Then
r.NumberFormat = "#,###.###, ;(#,###.###,);-;"
Else
r.NumberFormat = "#,###, ;(#,###,);text;"
End If
Else
r.NumberFormat = "General"
End If
Next
End Sub
Title | # Comments | Views | Activity |
---|---|---|---|
Excel Formula - If And on Blank Cell | 7 | 24 | |
Pivot help | 3 | 21 | |
Excel - Page layout - Margins | 7 | 31 | |
Excel Pivot Table with No Summary Fields | 7 | 27 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!