L'indice ne correspond pas à la selection

Résolu
Ctesias Messages postés 786 Statut Membre -  
Ctesias Messages postés 786 Statut Membre -
Bonjour,

Voila:

Private Sub CommandButton2_Click()
For i = 1 To 6
If Sheets("INFORMATIONS").Cells(18, 4).Text = Sheets("Grande").Cells(16, i).Value Then
Sheets("Grande").Cells(17, i).Value = Sheets("INFORMATIONS").Cells(18, 5).Value
End If
Next
End Sub


"L'indice ne correspond pas à la selection" en surlignant :
"If Sheets("INFORMATIONS").Cells(18, 4).Text = Sheets("Grande").Cells(16, i).Value Then"

je ne comprend pas pourquoi....

Ctesias,

3 réponses

  1. -nicolas- Messages postés 4208 Date d'inscription   Statut Contributeur Dernière intervention   1 312
     
    Bonjour,

    tu as essayé en remplaçant Cells(18, 4).Text par Cells(18, 4).Value ?
    Il me semble que cela peut régler le problème.
    0
  2. Ctesias Messages postés 786 Statut Membre 36
     
    Yep, c'etait le premier truc que j'avais essayé,mais ca ne regle pas le probleme :s
    0
    1. pijaku Messages postés 13513 Date d'inscription   Statut Modérateur Dernière intervention   2 773
       
      Bonjour,
      Essaye ceci d'abord :
      Private Sub CommandButton2_Click()
      Dim Chaine As String, Result As String
      
      With Sheets("INFORMATIONS")
          Chaine = .Cells(18, 4).Text
          Result = .Cells(18, 5).Value
      End With
      For i = 1 To 6
      With Sheets("Grande")
          If .Cells(16, i).Value = Chaine Then
              .Cells(17, i).Value = Result
          End If
      End With
      Next
      End Sub

      A toi d'adapter Result As ... type de variable adéquat.
      0
  3. Ctesias Messages postés 786 Statut Membre 36
     
    probleme resolu....

    C'ets tout bete, mais je ne comprend pas pourquoi Sheets("INFORMATIONS") ne marche pas, mais actvieszheet marche...
    0