OVH Cloud OVH Cloud

AAAAAHHHH???? je ne comprends pas!

2 réponses
Avatar
CHRISTOPHE
Avec ce code il me repere les doubons mais me cree une erreur 424 et me
montre la ligne

MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"

POURQUOI???


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Range("Feuil1!A1").CurrentRegion
x = .Count
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
y = .SpecialCells(xlCellTypeVisible).Count
If x <> y Then
Sheets("Feuil1").Select
For Each c In Range("A1:A" & [A65536].End(3).Row)
If c.EntireRow.Hidden = True Then MsgBox "La ligne : " &
c.Row _
& " est un doublon !":
Next
Sheets("Feuil1").ShowAllData
MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"
Cancel = True
End If
End With
On Error Resume Next
Sheets("Feuil1").ShowAllData
End Sub

2 réponses

Avatar
michdenis
Voir message précédent !


"CHRISTOPHE" a écrit dans le message de news:
Avec ce code il me repere les doubons mais me cree une erreur 424 et me
montre la ligne

MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"

POURQUOI???


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Range("Feuil1!A1").CurrentRegion
x = .Count
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
y = .SpecialCells(xlCellTypeVisible).Count
If x <> y Then
Sheets("Feuil1").Select
For Each c In Range("A1:A" & [A65536].End(3).Row)
If c.EntireRow.Hidden = True Then MsgBox "La ligne : " &
c.Row _
& " est un doublon !":
Next
Sheets("Feuil1").ShowAllData
MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"
Cancel = True
End If
End With
On Error Resume Next
Sheets("Feuil1").ShowAllData
End Sub
Avatar
CHRISTOPHE
merci
"michdenis" a écrit dans le message de news:

Voir message précédent !


"CHRISTOPHE" a écrit dans le message de news:

Avec ce code il me repere les doubons mais me cree une erreur 424 et me
montre la ligne

MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"

POURQUOI???


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Range("Feuil1!A1").CurrentRegion
x = .Count
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
y = .SpecialCells(xlCellTypeVisible).Count
If x <> y Then
Sheets("Feuil1").Select
For Each c In Range("A1:A" & [A65536].End(3).Row)
If c.EntireRow.Hidden = True Then MsgBox "La ligne : " &
c.Row _
& " est un doublon !":
Next
Sheets("Feuil1").ShowAllData
MsgBox "Fichier non enregistré, La ligne : " & c.Row _
& " est un doublon !"
Cancel = True
End If
End With
On Error Resume Next
Sheets("Feuil1").ShowAllData
End Sub