Bonjour à tous,
j'ai une macro qui tourne sous 2003, je souhaite la faire passer sur 2007... Tout fonctionne au sein de la macro mais qd je ferme le fichier 2007 et que je le reouvre, j'ai l'erreur :

Excel found unreadable content in '2007.xlsm'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.
Puis à l'ouverture :
Removed Feature: Data validation from /xl/worksheets/sheet1.xml part
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error031680_01.xml</logFileName>
<summary>Errors were detected in file 'G:\...\2007.xlsm'</summary>
- <removedFeatures summary="Following is a list of removed features:">
<removedFeature>Removed Feature: Data validation from /xl/worksheets/sheet1.xml part</removedFeature>
</removedFeatures>
</recoveryLog>

Mon code est:

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
Private Sub Worksheet_Change(ByVal Target As Range)
 
Dim Lst As String
Dim c As Range
 
If Target.Count = 1 And Target.Column = 1 And Target.Row > 1 Then
    If Target.Value <> "" Then
    Application.ScreenUpdating = False
        Target.Offset(0, 10).Validation.Delete
        With Sheets("Contacts")
            .AutoFilterMode = False
            .Range("Company").AutoFilter Field:=4, Criteria1:=Target.Value
            For Each c In .Range("Contact").SpecialCells(xlCellTypeVisible)
                If c.Row > 1 Then Lst = Lst & "," & c.Value
            Next c
            .AutoFilterMode = False
        End With
        Lst = Mid(Lst, 2)
        If Lst <> "" Then Target.Offset(0, 10).Validation.Add Type:=xlValidateList, Formula1:=Lst
    Else
        Application.EnableEvents = False
        Target.Offset(0, 10).ClearContents
        Application.EnableEvents = True
    End If
End If
End Sub
 
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Kol As New Collection
Dim Lst As String
Dim i As Integer
Dim c As Range
 
If Target.Count = 1 And Target.Column = 1 And Target.Row > 1 Then
    Target.Validation.Delete
    With Sheets("Contacts")
        For Each c In .Range("Company")
            On Error Resume Next
            Kol.Add c.Value, c.Value
            On Error GoTo 0
        Next c
    End With
    For i = 1 To Kol.Count
        Lst = Lst & "," & Kol(i)
    Next i
    Lst = Mid(Lst, 2)
    If Lst <> "" Then Target.Validation.Add Type:=xlValidateList, Formula1:=Lst
End If
End Sub
J'ai déjà retiré Application.ScreenUpdating = False, cela crée la meme erreur.

Ca retire donc toutes mes listes, j'enregistre autre part, fais quelques modifs et le problème resurgit.

Je cherche depuis 3j et suis récent en VBA donc je ne sais pas trop quelle partie du code ne peut s'appliquer à 2007,

Merci de votre aide future,
efesdark.