XL 2019 rendre visible button commandbutton si plusieurs texbox renseigner

PETIT YANNICK

XLDnaute Occasionnel
Bonjour

Je cherche a rendre visible un bouton de commande dans mon cas commandbutton5 lorsque TextBox4 TextBox5 seront renseigné.
Ce bouton de commande sert a renseigner le fichier de BDD liste_plan_z .
J'ai le message d'erreur 424

avez vous une idée de comment procéder?
voici le code
merci d'avance


Sub CommandButton5_Click()


If TextBox4 <> "" And TextBox5 <> "" Then
CommandButton2.Visible = False
Else
CommandButton2.Visible = True

End If

With Workbooks.Open(filename:=ThisWorkbook.Path & "\LISTE_PLAN_Z.xlsx")



Dim ligne As String
ligne = .Worksheets("Feuil1").Range("F" & Rows.Count).End(xlUp).Row + 1


With .Worksheets("Feuil1")
.Range("A" & ligne).Value = ThisWorkbook.Sheets("Feuil1").Range("I21").Value
.Range("E" & ligne).Value = ThisWorkbook.Sheets("Feuil1").Range("H21").Value
.Range("F" & ligne).Value = Format(Val(Right(Range("F" & ligne - 1).Value, 4)) + 1, "Z0000") 'ThisWorkbook.Sheets("Feuil1").Range("F" & ligne - 1).Value + 1


Dim DerniereCelluleColonneF As String
DerniereCelluleColonneF = .Cells(.Rows.Count, "F").End(xlUp).Value


'copie nouveau N°plan dans G28
ThisWorkbook.Sheets("Feuil1").Range("G28").Value = DerniereCelluleColonneF

End With

End With
Workbooks("LISTE_PLAN_Z").Save
Workbooks("LISTE_PLAN_Z").Close False 'ferme


Dim filename As String
filename = Range("G28")
ActiveWorkbook.SaveAs filename:="C:\Users\yap\Desktop\plan catalogue\" & filename & ".xls"

'ThisWorkbook.Close False 'ferme

End Sub
 

Pièces jointes

  • LISTE_PLAN_Z.xlsx
    9.4 KB · Affichages: 6
  • 2019_09_09_22_04_14_Window.jpg
    2019_09_09_22_04_14_Window.jpg
    191.5 KB · Affichages: 10
  • Products catalogue NRO.xlsm
    37.5 KB · Affichages: 3

fanfan38

XLDnaute Barbatruc
Bonjour
Bien que je ne comprends rien à ton programme (textbox4 et 5 ne sont pas sauvegardé...)
il n'y a plus de message d'erreur quand tu lances la macro
Private Sub CommandButton5_Click()

Tu ne peux mettre une macro d'un bouton d'userform dans un module ou alors il faut le dire à l'ordi...

If userform1.TextBox4 <> "" And userform1.TextBox5 <> "" Then
userform1.CommandButton2.Visible = False

A+ François
 

Pièces jointes

  • Products catalogue NRO.xlsm
    38.4 KB · Affichages: 6

PETIT YANNICK

XLDnaute Occasionnel
Merci pour le retour, c'est pas exactement ce qu'il me faudrait, la il devient invisible au clic.
je souhaiterais que le bouton commandebuton5 change d'état.
Visible ou invible selon l'état des TextBox4 et TextBox5

1)Visible lorsque TextBox4 et TextBox5 renseignée
2)invisible tant que TextBox4 et TextBox5 non renseignée
 
Dernière édition:

Discussions similaires

Membres actuellement en ligne

Statistiques des forums

Discussions
311 725
Messages
2 081 943
Membres
101 849
dernier inscrit
florentMIG