Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Ela 22 Cluj pe Simpatie.ro
Femeie
22 ani
Cluj
cauta Barbat
22 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Don't Show Decimals if They are ,00 but Show Otherwise Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Select desired destination to apply the 2 rules we're going to create below, then go to Conditional Formatting - New Rule - Use a formula to determine which cells to format.

=MOD(J1;1)=0
Then click the Format button and set Category to Number with NO DECIMALS.

=MOD(J1;1)>0
Then click the Format button and set Category to Number WITH DECIMALS.

Source:

Modificat de TRaP (acum 5 ani)


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Add the following macro to Personal.xlsb and to QAT.

This works for all cells in a sheet. If you want to make it work only for selection, read the comment lines in the macro code.


Sub NoZeroDecimals()
Application.ScreenUpdating = False

'##### Activate next 4 lines if you want to change NumberFormat _
       only for selected cells, not for the entire sheet
'Dim R As Range
'Set R = Selection
'With ActiveSheet
'For Each cell In R


    For Each cell In ActiveSheet.UsedRange '##### Also DEactivate this line
        If IsNumeric(cell.Value) Then
            If Int(cell.Value) = cell.Value Then
                cell.NumberFormat = "#,###0"
            Else
                cell.NumberFormat = "0.###"
            End If
        End If
    Next cell

' End With '##### Also activate this line for selected cells
Application.ScreenUpdating = True
End Sub


Source:


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
updated to add missing "End With" at the end of the code.

pus acum 3 luni
   
Pagini: 1  

Mergi la