Bonjour,
Comment faire pour convertir un nombre dans une cellule au format 0 au lieu du format 0.00 dans le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Sub COPYPASTESEL()
Worksheets("RECUP").Activate
ActiveWorkbook.Save
MsgBox "FIN REMONTEE DEBUT CALCUL"
 
 
 
 
    Dim PremLig As Long
    Dim Derlign As Long
    Dim Lign As Long
    Dim Col As Integer
    Dim NomF As String
 
    NomF = "RECUP"
 
 
    With Sheets("RECUP").Range("DV2:DV1000")
Cells(2, 126).Select
 
y = 2
 
While y <= 1000
 
 
 
 
Set cel = Cells.Find(What:="FAUX", After:=ActiveCell, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
 
If cel = "VRAI" Then
 
Cells(y + 1, 126).Select
Set cel = Cells.Find(What:="FAUX", After:=ActiveCell, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
 
 
If cel = "FAUX" Then
 
 
Cells(y + 2, 7).Select
 
PremLig = y + 2
 
 
 
 
 
    Derlign = Range("A2", Range("A2").End(xlDown).Offset(1, 0)).Rows.Count + 1
 
 
 
    For Lign = PremLig To Derlign
        If Cells(Lign, 1).Value <> "" Then
            For Col = 7 To 125
            Cells(Lign, Col).Select
                If Not IsNumeric(Cells(Lign, Col).Value) Or Cells(Lign, Col).Value = "" Then
                    Cells(Lign, Col).Value = Cells(Lign, Col).Value
                Else
                    Cells(Lign, Col).NumberFormat = "General"
                    Cells(Lign, Col).Value = CSng(Cells(Lign, Col).Value)
 
                End If
            Next
        End If
    Next
 
 End If
 End If
 
 y = y + 1
 
 Wend
 
 
 
MsgBox "FIN"
 
 End With
End Sub
J'essaie de remplacer:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
Cells(Lign, Col).NumberFormat = "General"
par:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
Cells(Lign, Col).NumberFormat = "Standard"
et j'ai une erreur méthode range.
Est-ce parce que le code trouve des nombres déjà à ce format dans certaines cellules?????
Dans ce cas, comment remédier au problème?