Erreur Impossible de définir la propriété Value. Le type ne correspond pas

maval

XLDnaute Barbatruc
Bonjour,

J'ai une erreur que je n'arrive pas a trouver malgré toute les recherches,

sur la ligne
Code:
MultiPage1.Pages(1).Controls("TextBox" & k) = .Cells(lig, k)

message: Erreur d'exécution 2147352571 (80020005):
Impossible de définir la propriété Value. Le type ne correspond pas.

Code:
  Private Sub UserForm_Initialize()


MultiPage1.Pages(0).Visible = True:
Me.MultiPage1.Value = 0 ' Activer la page d'accueil
Label22.Caption = MultiPage1.SelectedItem.Caption


  Dim Rep, NomFic, sheetsUse As String
  Dim i, j As Integer
  Dim tableau() As String
       Me.MultiPage1.Value = 0
  If choose Then

  Rep = "J:\Réalisateur\"
  GoTo suite1
         Else
  Rep = "J:\acteur\"
  End IfWith Feuil3 

lig = Application.Match(NomRéalisateur, .[B1:B65000], 0)


If Not IsNumeric(lig) Then GoTo suite1
    Me.Label5.Caption = NomRéalisateur
    For k = 1 To 8
    MultiPage1.Pages(1).Controls("TextBox" & k) = .Cells(lig, k)
    Next

    If .Range("G" & lig).Value <> "" Then
      MultiPage1.Pages(1).TextBox7.Value = .Range("G" & lig).Value 'Décédé le
      MultiPage1.Pages(1).Label14.Caption = .Range("h" & lig).Value 'Décédé à l'âge
      MultiPage1.Pages(1).Label23.Caption = .Range("l" & lig).Value 'Il aurait l'âge
    Else
      MultiPage1.Pages(1).TextBox7.Value = "Non décédé"
    End If

      MultiPage1.Pages(1).TextBox8.Value = .Range("B" & lig).Value 'Nom usuel
      MultiPage1.Pages(1).TextBox2.Value = .Range("i" & lig).Value 'Nom naissance
      MultiPage1.Pages(1).Label16.Caption = .Range("j" & lig).Value & " (ième ligne)" 'N° de ligne

  Label16.Caption = " La fiche se situe sur la ...." & " " & Label16.Caption & " de la feuille BdD Acteurs "
     
NomFic = Label5.Caption 'Pour la photo acteur
End With

Je vous remercie d'avance
 
Dernière édition:

maval

XLDnaute Barbatruc
Re : Erreur Impossible de définir la propriété Value. Le type ne correspond pas

Bonjour Pierrejean

Voilà mon code entier.

Code:
Private Sub UserForm_Initialize()


MultiPage1.Pages(0).Visible = True:
Me.MultiPage1.Value = 0 ' Activer la page d'accueil
Label22.Caption = MultiPage1.SelectedItem.Caption


  Dim Rep, NomFic, sheetsUse As String
  Dim i, j As Integer
  Dim tableau() As String
       Me.MultiPage1.Value = 0
  If choose Then

  Rep = "J:\Réalisateur\"
  GoTo suite1
         Else
  Rep = "J:\acteur\"
  End If

  With Feuil3 'Feuille "Etat Civil"
 
lig = Application.Match(NomRéalisateur, .[B1:B65000], 0)

If Not IsNumeric(lig) Then GoTo suite1
    Me.Label5.Caption = NomRéalisateur
    For k = 1 To 8
    MultiPage1.Pages(1).Controls("TextBox" & k) = .Cells(lig, k)
    Next

    If .Range("G" & lig).Value <> "" Then
      MultiPage1.Pages(1).TextBox7.Value = .Range("G" & lig).Value 'Décédé le
      MultiPage1.Pages(1).Label14.Caption = .Range("h" & lig).Value 'Décédé à l'âge
      MultiPage1.Pages(1).Label23.Caption = .Range("l" & lig).Value 'Il aurait l'âge
    Else
      MultiPage1.Pages(1).TextBox7.Value = "Non décédé"
    End If

      MultiPage1.Pages(1).TextBox8.Value = .Range("B" & lig).Value 'Nom usuel
      MultiPage1.Pages(1).TextBox2.Value = .Range("i" & lig).Value 'Nom naissance
      MultiPage1.Pages(1).Label16.Caption = .Range("j" & lig).Value & " (ième ligne)" 'N° de ligne

  Label16.Caption = " La fiche se situe sur la ...." & " " & Label16.Caption & " de la feuille BdD Acteurs "
     
NomFic = Label5.Caption 'Pour la photo acteur
End With

suite1:
With Feuil7 'Feuille 
   'ici remplissage biographie
lig = ""
lig = Application.Match(Label5, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite2

MultiPage1.Pages(2).TextBox9 = .Cells(lig, 2)
MultiPage1.Pages(2).TextBox9.SelStart = 0


MultiPage1.Pages(2).Label18.Caption = .Range("c" & lig).Value & " (ième ligne)" 'N° de ligne
  Label18.Caption = " La fiche se situe sur la ...." & " " & Label18.Caption
End With


suite2:

With Feuil5 

MultiPage1.Pages(3).Label20.Caption = .Range("bq" & lig).Value & " (ième ligne)" 'N° de ligne
Label20.Caption = " La fiche se situe sur la ...." & " " & Label20.Caption


lig = Application.Match(NomRéalisateur, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite3
For k = 2 To 68
ListBox1.AddItem .Cells(1, k)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(lig, k)
Next
End With

suite3:

With Feuil9 



MultiPage1.Pages(4).Label21.Caption = .Range("ef" & lig).Value & " (ième ligne)" 'N° de ligne
Label21.Caption = " La fiche se situe sur la ...." & " " & Label21.Caption


lig = Application.Match(NomRéalisateur, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite5
i = -1
For k = 2 To 134 Step 2
ListBox2.AddItem .Cells(1, k): i = i + 1
ListBox2.List(i, 1) = .Cells(lig, k)
ListBox2.List(i, 2) = .Cells(lig, k + 1)
Next

End With
GoTo suite8

suite4:

With Feuil4 


lig = Application.Match(NomRéalisateur, .[B1:B65000], 0)
If Not IsNumeric(lig) Then GoTo suite5

    Me.Label5.Caption = NomRéalisateur
    For k = 1 To 6
    'MultiPage1.Pages(1).Controls("TextBox" & k) = .Cells(lig, k) 'Métier
    Next

    If .Range("G" & lig).Value <> "" Then
    MultiPage1.Pages(1).TextBox7.Value = .Range("G" & lig).Value 'Décédé le
    MultiPage1.Pages(1).Label14.Caption = .Range("h" & lig).Value 'Décédé à l'âge
    MultiPage1.Pages(1).Label23.Caption = .Range("l" & lig).Value 'Il aurait l'âge

    Else

    MultiPage1.Pages(1).TextBox7.Value = "Non décédé"
    End If

      MultiPage1.Pages(1).TextBox8.Value = .Range("B" & lig).Value 'Nom usuel
      MultiPage1.Pages(1).TextBox2.Value = .Range("i" & lig).Value 'Nom naissance
      MultiPage1.Pages(1).Label16.Caption = .Range("j" & lig).Value & " (ième ligne)" 'N° de ligne

  Label16.Caption = " La fiche se situe sur la ...." & " " & Label16.Caption & " de la feuille BdD Noms "
    NomFic = Label5.Caption 'Pour la photo réalisateur
      End With

suite5:

With Feuil6

MultiPage1.Pages(3).Label20.Caption = .Range("bq" & lig).Value & " (ième ligne)" 'N° de ligne
Label20.Caption = " La fiche se situe sur la ...." & " " & Label20.Caption


lig = Application.Match(NomRéalisateur, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite6
For k = 2 To 68
ListBox1.AddItem .Cells(1, k)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(lig, k)
Next
End With

suite6:
With Feuil8 

lig = ""
lig = Application.Match(Label5, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite7

MultiPage1.Pages(2).TextBox9 = .Cells(lig, 2)
MultiPage1.Pages(2).TextBox9.SelStart = 0


MultiPage1.Pages(2).Label18.Caption = .Range("c" & lig).Value & " (ième ligne)" 'N° de ligne
  Label18.Caption = " La fiche se situe sur la ...." & " " & Label18.Caption

End With

suite7:

With Feuil10 

MultiPage1.Pages(4).Label21.Caption = .Range("ef" & lig).Value & " (ième ligne)" 'N° de ligne
Label21.Caption = " La fiche se situe sur la ...." & " " & Label21.Caption


lig = Application.Match(NomRéalisateur, .[A1:A65000], 0)
If Not IsNumeric(lig) Then GoTo suite8
i = -1
For k = 2 To 134 Step 2
ListBox2.AddItem .Cells(1, k): i = i + 1
ListBox2.List(i, 1) = .Cells(lig, k)
ListBox2.List(i, 2) = .Cells(lig, k + 1)
Next

End With

suite8:
Image1.Visible = True
If Dir(Rep & NomFic & ".jpg") <> "" Then
    Image1.Picture = LoadPicture(Rep & NomFic & ".jpg")
Else
    Image1.Picture = LoadPicture
End If



End Sub

et dans un module il y a

Code:
Public NomRéalisateur As String
 

pierrejean

XLDnaute Barbatruc
Re : Erreur Impossible de définir la propriété Value. Le type ne correspond pas

Re
OK
mais es-tu sur que NomRealisateur a bien été initialisé avant cette ligne
lig = Application.Match(NomRéalisateur, .[B1:B65000], 0)
et qu'il existe dans la colonne B
 

pierrejean

XLDnaute Barbatruc
Re : Erreur Impossible de définir la propriété Value. Le type ne correspond pas

Sans garantie teste

lig = Application.Match(NomRéalisateur, .[L1:L65000], 0)

NB :un fichier lourd peut se dégraisser et/ou se zipper

Nb: plus de réponse de ma part sans fichier
 

Discussions similaires

Réponses
6
Affichages
843

Statistiques des forums

Discussions
312 305
Messages
2 087 085
Membres
103 461
dernier inscrit
dams94