Le problème que je rencontre est le suivant:
Dans le code du bouton "Valider" de l'USF, j'ai mis
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
Ce qui me permet de savoir si une pièce est déjà indicatée ou pas.
Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne
que je viens d'inscrire.
If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.
Voici le code complet:
Private Sub CommandButton1_Click()
Dim Li As Long
Dim shDB As Worksheet
Set shDB = ThisWorkbook.Sheets("2004")
Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1
shDB.Cells(Li, 2).Value = Me.TextBox7.Text
shDB.Cells(Li, 3).Value = Me.TextBox6.Text
shDB.Cells(Li, 4).Value = Me.TextBox3.Text
shDB.Cells(Li, 5).Value = Me.TextBox4.Text
shDB.Cells(Li, 6).Value = Me.TextBox5.Text
Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" &
Li), Type:=xlLinearTrend
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending,
header:=xlYes
Set shDB = Nothing
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
BJ
Bonsoir, Je n'ai pas suivi le fil mais je pense à ceçi Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then Cells(Li,9).ClearContents 'effacement de la cellule UserForm1.Show End If
Albert FOUARGE a écrit dans le message :
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Bonsoir,
Je n'ai pas suivi le fil mais je pense à ceçi
Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
Cells(Li,9).ClearContents 'effacement de la cellule
UserForm1.Show
End If
Albert FOUARGE <af0509@teledisnet.be> a écrit dans le message :
4113B2D6.9080307@teledisnet.be...
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant:
Dans le code du bouton "Valider" de l'USF, j'ai mis
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
Ce qui me permet de savoir si une pièce est déjà indicatée ou pas.
Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne
que je viens d'inscrire.
If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.
Voici le code complet:
Private Sub CommandButton1_Click()
Dim Li As Long
Dim shDB As Worksheet
Set shDB = ThisWorkbook.Sheets("2004")
Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1
shDB.Cells(Li, 2).Value = Me.TextBox7.Text
shDB.Cells(Li, 3).Value = Me.TextBox6.Text
shDB.Cells(Li, 4).Value = Me.TextBox3.Text
shDB.Cells(Li, 5).Value = Me.TextBox4.Text
shDB.Cells(Li, 6).Value = Me.TextBox5.Text
Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" &
Li), Type:=xlLinearTrend
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" &
Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending,
header:=xlYes
Set shDB = Nothing
End Sub
Bonsoir, Je n'ai pas suivi le fil mais je pense à ceçi Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then Cells(Li,9).ClearContents 'effacement de la cellule UserForm1.Show End If
Albert FOUARGE a écrit dans le message :
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Albert FOUARGE
Merci Bruno
Mais cela ne fonctionne pas, il n'efface rien or, je voudrais justement qu'il efface les cellules A,B,B,C,D,E,F si l'USF s'affiche. Merci quand même
BJ a écrit:
Bonsoir, Je n'ai pas suivi le fil mais je pense à ceçi Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then Cells(Li,9).ClearContents 'effacement de la cellule UserForm1.Show End If
Albert FOUARGE a écrit dans le message :
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" &
Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Merci Bruno
Mais cela ne fonctionne pas, il n'efface rien or, je voudrais justement
qu'il efface les cellules A,B,B,C,D,E,F si l'USF s'affiche.
Merci quand même
BJ a écrit:
Bonsoir,
Je n'ai pas suivi le fil mais je pense à ceçi
Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
Cells(Li,9).ClearContents 'effacement de la cellule
UserForm1.Show
End If
Albert FOUARGE <af0509@teledisnet.be> a écrit dans le message :
4113B2D6.9080307@teledisnet.be...
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant:
Dans le code du bouton "Valider" de l'USF, j'ai mis
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
Ce qui me permet de savoir si une pièce est déjà indicatée ou pas.
Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne
que je viens d'inscrire.
If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.
Voici le code complet:
Private Sub CommandButton1_Click()
Dim Li As Long
Dim shDB As Worksheet
Set shDB = ThisWorkbook.Sheets("2004")
Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1
shDB.Cells(Li, 2).Value = Me.TextBox7.Text
shDB.Cells(Li, 3).Value = Me.TextBox6.Text
shDB.Cells(Li, 4).Value = Me.TextBox3.Text
shDB.Cells(Li, 5).Value = Me.TextBox4.Text
shDB.Cells(Li, 6).Value = Me.TextBox5.Text
Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" &
Li), Type:=xlLinearTrend
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" &
Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending,
header:=xlYes
Set shDB = Nothing
End Sub
Mais cela ne fonctionne pas, il n'efface rien or, je voudrais justement qu'il efface les cellules A,B,B,C,D,E,F si l'USF s'affiche. Merci quand même
BJ a écrit:
Bonsoir, Je n'ai pas suivi le fil mais je pense à ceçi Bruno
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then Cells(Li,9).ClearContents 'effacement de la cellule UserForm1.Show End If
Albert FOUARGE a écrit dans le message :
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" &
Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
FxM
Bonjour Albert,
Au pif et non testé :
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then for zaza = 2 to 6 shbd.cells(Li,zaza).clearcontent next zaza UserForm1.Show End If
@+ FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Bonjour Albert,
Au pif et non testé :
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
for zaza = 2 to 6
shbd.cells(Li,zaza).clearcontent
next zaza
UserForm1.Show
End If
@+
FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant:
Dans le code du bouton "Valider" de l'USF, j'ai mis
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
Ce qui me permet de savoir si une pièce est déjà indicatée ou pas.
Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne
que je viens d'inscrire.
If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.
Voici le code complet:
Private Sub CommandButton1_Click()
Dim Li As Long
Dim shDB As Worksheet
Set shDB = ThisWorkbook.Sheets("2004")
Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1
shDB.Cells(Li, 2).Value = Me.TextBox7.Text
shDB.Cells(Li, 3).Value = Me.TextBox6.Text
shDB.Cells(Li, 4).Value = Me.TextBox3.Text
shDB.Cells(Li, 5).Value = Me.TextBox4.Text
shDB.Cells(Li, 6).Value = Me.TextBox5.Text
Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" &
Li), Type:=xlLinearTrend
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending,
header:=xlYes
Set shDB = Nothing
End Sub
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then for zaza = 2 to 6 shbd.cells(Li,zaza).clearcontent next zaza UserForm1.Show End If
@+ FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Albert FOUARGE
Merci FxM Ca marche très bien. encore un grand merci
FxM a écrit:
Bonjour Albert,
Au pif et non testé :
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then for zaza = 2 to 6 shbd.cells(Li,zaza).clearcontent next zaza UserForm1.Show End If
@+ FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub
Est-Possible et encore merci
Merci FxM
Ca marche très bien.
encore un grand merci
FxM a écrit:
Bonjour Albert,
Au pif et non testé :
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
for zaza = 2 to 6
shbd.cells(Li,zaza).clearcontent
next zaza
UserForm1.Show
End If
@+
FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant:
Dans le code du bouton "Valider" de l'USF, j'ai mis
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
Ce qui me permet de savoir si une pièce est déjà indicatée ou pas.
Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne
que je viens d'inscrire.
If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.
Voici le code complet:
Private Sub CommandButton1_Click()
Dim Li As Long
Dim shDB As Worksheet
Set shDB = ThisWorkbook.Sheets("2004")
Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1
shDB.Cells(Li, 2).Value = Me.TextBox7.Text
shDB.Cells(Li, 3).Value = Me.TextBox6.Text
shDB.Cells(Li, 4).Value = Me.TextBox3.Text
shDB.Cells(Li, 5).Value = Me.TextBox4.Text
shDB.Cells(Li, 6).Value = Me.TextBox5.Text
Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" &
Li), Type:=xlLinearTrend
Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F"
& Li
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then
UserForm1.Show
End If
( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then
delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending,
header:=xlYes
Set shDB = Nothing
End Sub
Merci FxM Ca marche très bien. encore un grand merci
FxM a écrit:
Bonjour Albert,
Au pif et non testé :
If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then for zaza = 2 to 6 shbd.cells(Li,zaza).clearcontent next zaza UserForm1.Show End If
@+ FxM
On 06/08/04 18:33, Albert FOUARGE wrote:
Bonsoir à tous
JP les formules sont nickel merci encore
Le problème que je rencontre est le suivant: Dans le code du bouton "Valider" de l'USF, j'ai mis If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If Ce qui me permet de savoir si une pièce est déjà indicatée ou pas. Ce que je voudrais c'est que si l'USF1 s'affiche, il supprime la ligne que je viens d'inscrire. If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire. Voici le code complet:
Private Sub CommandButton1_Click() Dim Li As Long Dim shDB As Worksheet Set shDB = ThisWorkbook.Sheets("2004") Li = shDB.Range("a1").CurrentRegion.Rows.Count + 1 shDB.Cells(Li, 2).Value = Me.TextBox7.Text shDB.Cells(Li, 3).Value = Me.TextBox6.Text shDB.Cells(Li, 4).Value = Me.TextBox3.Text shDB.Cells(Li, 5).Value = Me.TextBox4.Text shDB.Cells(Li, 6).Value = Me.TextBox5.Text Range("a" & Li - 1).AutoFill Destination:=Range("a" & Li - 1 & ":a" & Li), Type:=xlLinearTrend Cells(Li, 9).Formula = "= C" & Li & " & D" & Li & " & E" & Li & " & F" & Li If Application.CountIf(Range("I:I"), Range("I" & Li)) > 1 Then UserForm1.Show End If ( Ici ce que je voudrais écrire: If UserForm1=Userform1.Show Then delete la ligne active qui vient de s'écrire.)
shDB.Rows("1:" & Li).Sort key1:=shDB.Range("a1"), order1:=xlAscending, header:=xlYes Set shDB = Nothing End Sub