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
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
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
Voir message précédent !
"CHRISTOPHE" <christophe.reina@free.fr> a écrit dans le message de news: eMMfOTRxEHA.3276@TK2MSFTNGP15.phx.gbl...
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
"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
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
merci
"michdenis" <michdenis@hotmail.com> a écrit dans le message de news:
uwAfQ3SxEHA.2316@TK2MSFTNGP15.phx.gbl...
Voir message précédent !
"CHRISTOPHE" <christophe.reina@free.fr> a écrit dans le message de news:
eMMfOTRxEHA.3276@TK2MSFTNGP15.phx.gbl...
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
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