Re : probleme transition de version
Bonjour fets,
sans voir le code utilisé, cela va être dur pour t'aider... Mets un fichier en pièce jointe, avec le code, sans données confidentielles.
bon après midi
@+
Voici toute la parti macro du fichier :
Option Explicit
Function findplan(numdevis)
Application.Volatile ' rend la mise a jour de la fonction continue
Dim DerLig As Long, Lig As Long, VPlan As String
findplan = ""
With Sheets("N° PLAN")
DerLig = .Range("A" & Rows.Count).End(xlUp).Row ' recherche à la colonne A en partant de la derniere
For Lig = 2 To DerLig ' si trouvé lire colonne 2
VPlan = .Range("A" & Lig).Value
' Vérifier si le devis du plan correspond à la recherche
If CStr(.Range("B" & Lig)) = numdevis Then
findplan = findplan & VPlan & " " ' séparation des resultats trouvés
End If
Next Lig
End With
If Len(findplan) > 0 Then
' Enlever la dernière séparation
findplan = Left(findplan, Len(findplan) - 3)
End If
End Function
Function findplan2(numdossier)
Application.Volatile ' rend la mise a jour de la fonction continue
Dim DerLig As Long, Lig As Long, VPlan As String
findplan2 = ""
With Sheets("N° PLAN")
DerLig = .Range("A" & Rows.Count).End(xlUp).Row
For Lig = 2 To DerLig
' Vérifier si le devis du plan correspond à la recherche
If CStr(.Range("C" & Lig)) = numdossier Then
VPlan = .Range("A" & Lig).Value
findplan2 = findplan2 & VPlan & " "
End If
Next Lig
End With
If Len(findplan2) > 0 Then
' Enlever les 3 derniers caractères et non la dernière virgule
findplan2 = Left(findplan2, Len(findplan2) - 3)
End If
End Function
------------------------------------------
Private Sub CommandButton1_Click()
Dim li As Long 'déclare la variable li
li = Range("E65536").End(xlUp).Row + 1 'définit la variable li
la = Range("E65536").End(xlUp).Row ''définit la variable li=la-1
'place les données dans le tableau
Cells(li, 1).Value = Cells(Range("A65536").End(xlUp).Row, 1).Value + 1 ' incrémentation n° devis
Cells(li, 3).Value = TextBox3.Value 'colonne client
Cells(li, 6).Value = TextBox5.Value 'colonne ref client
Cells(li, 9).Value = TextBox15.Value 'colonne désignation
Cells(li, 5).Value = Application.Proper(Format(Now, "dd/mmmm/yyyy")) 'colonne date
Load Userform1 'ouvre userfom
End Sub
Private Sub CommandButton3_Click() 'Fermeture de la fenetre d'ajout
End
End Sub
Private Sub ListBox1_Click()
Dim Lig As Long
Lig = Me.ListBox1.Column(1, Me.ListBox1.ListIndex)
Me.TextBox3.Value = Sheets("Client").Range("A" & Lig)
End Sub
Private Sub TextBox3_Change()
Dim DerLig As Long, I As Long, VTxt As String, VNom As String
' Effacer la Listbox
Me.ListBox1.Clear
' Si le textbox contient une valeur
If Me.TextBox3.Value <> "" Then
' Récupère cette valeur
VTxt = UCase(Me.TextBox3.Value)
' Parcour la feuille
With Sheets("Client")
DerLig = .Range("A" & Rows.Count).End(xlUp).Row
For I = 2 To DerLig
' Récupère le nom de chaque ligne
VNom = Sheets("Client").Range("A" & I)
' Effectue la comparaison avec la/les lettre(s) saisie(s)
If UCase(VNom) Like VTxt & "*" Then
' Si ça correspond on ajoute le nom
Me.ListBox1.AddItem VNom
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = I
End If
Next I
End With
End If
End Sub
Private Sub UserForm_Click()
End Sub
merci