Format Cellule

DOMERGO

XLDnaute Nouveau
bONJOUR

Comment faire apparaitre la valeur Zéro (0) dans une cellule SI ELLE EST VIDE EN UTILISANT FORMAT DE CELLULE

mERCI
 

CelluleVide

XLDnaute Occasionnel
Re : Format Cellule

Bonjour,

Le format ne peut rien pour cela.

Un petit code vba qui marche apres avoir selectionné la plage de cellule:

Sub RemplaceVide
'
Dim cel As Range
For Each cel In Selection
cel = IIf(IsEmpty(cel), 0, cel.Value)
Next cel
End Sub

A essayer.
 

CelluleVide

XLDnaute Occasionnel
Re : Format Cellule

Bonjour Domingo,
il te suffit de selectionner tes cellules "en dure" dans la macro:
Exemple:

Sub RemplaceVide
'Selection des cellules:
Range("C5:C18,G8:G28,K6:K23").Select

'Modification:
Dim cel As Range
For Each cel In Selection
cel = IIf(IsEmpty(cel), 0, cel.Value)
Next cel
End Sub

A+
 

DOMERGO

XLDnaute Nouveau
Re : Format Cellule

bONJOUR

MON PROBLEME MAINTENENT EST QUE JE SUIS ENCORE UN FOIS (MALGRES UN REEL EFFORT ) INCAPABLE D'APPLIQUER CETTE MACRO SUR UNE MULTITUDE DE FEUILLETS CHOSI PAR UN INDEX.

DANS MON EXEMPLE JE VOUDRAIS PARTIR DE MON INDEX AFIN DE POUVOIR COCHER LES FEUILLETS AUXQUELS JE VEUX APPLIQUER CETTE MACRO QUI ME REMPLACECE LES VIDES PAR UNE LETTRE OU UN AUTRE CHOSE CAR JE NE VEUX PAS DE CELLULES VIDES....

DANS MON CLASSEUR CI DESSOUS JE VOUDRAIS POUVOIR APPLIQUER LA MACRO "REMPLACERVIDE" DE LA MEME MANIERE QUE LA MACRO UTILISEE POUR ETUDE 1 (VOIR BOUTON LANCER DANS INDEX)

MERCI
 

porcinet82

XLDnaute Barbatruc
Re : Format Cellule

Salut,

Tu es deja passé sur le forum (je me rappel puisque c'est moi qui est fait la macro associer a ton bouton), donc tu devrais tenir compte des remarques (voir celle de Spitnolan le 30/08 à 17h16), à savoir, ne pas utiliser les majuscules quand tu fais une demande, cela revient à crier...

Pour ta demande, voiciune adaptation, mais pas testée
Code:
Sub RemplaceVide_v2()
Dim tablo As Variant, i%, k%
Dim cel As Range
ReDim tablo(1 To Range("A65536").End(xlUp).Row)
For i = 1 To UBound(tablo)
    If Cells(i, 2).Value = "X" Then tablo(i) = Cells(i, 1).Value
Next i
With Sheets("Etude 1")
    For i = 1 To Sheets.Count
        For k = 1 To UBound(tablo)
            If tablo(k) = Sheets(i).Name Then
                For Each cel In .Range("C33:C106,D33:D106,E33:E106")
                    cel = IIf(IsEmpty(cel), 0, cel.Value)
                Next cel
            End If
        Next k
    Next i
End With
End Sub

@+
 

DOMERGO

XLDnaute Nouveau
Re : Format Cellule

bonjour a vous,

voila je n'avais pas compris pour les majuscules c'est vous dire le niveau...
Ceci dit merci porcinet pour ton code.
En fait le code ci dessus s'applique au feuillet etude 1 et je voudrais qu'il s'applique au feuillet correspondant aux noms coches dans le feuillet index.

Je peux etre + clair si necessaire...

Merci
 

porcinet82

XLDnaute Barbatruc
Re : Format Cellule

Salut,

Et bien tu aurais pu etre plus clair du premier coup ;)
Je ne suis pas sur d'avoir bien saisie, mais je tente tout de meme ma chance avec le code suivant :
Code:
Sub RemplaceVide_v2()
Dim tablo As Variant, i%, k%
Dim cel As Range
ReDim tablo(1 To Range("A65536").End(xlUp).Row)
For i = 1 To UBound(tablo)
    If Cells(i, 2).Value = "X" Then tablo(i) = Cells(i, 1).Value
Next i
For i = 1 To Sheets.Count
    For k = 1 To UBound(tablo)
        If tablo(k) = Sheets(i).Name Then
            For Each cel In Sheets(i).Range("C33:C106,D33:D106,E33:E106")
                cel = IIf(IsEmpty(cel), 0, cel.Value)
            Next cel
        End If
    Next k
Next i
End Sub

@+
 

Discussions similaires

Réponses
4
Affichages
220

Membres actuellement en ligne

Statistiques des forums

Discussions
312 321
Messages
2 087 265
Membres
103 501
dernier inscrit
talebafia