Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Problème formule et concaténation suite

4 réponses
Avatar
Albert FOUARGE
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

4 réponses

Avatar
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



Avatar
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








Avatar
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



Avatar
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