appeler une cellule via userform
bonjour, j'ai un petit problème. J'ai réalisé un userform qui affiche les informations d'une ligne d'un tableau en fonction du numéro de ligne que l'on précise grâce a une liste déroulante.
Cependant j'aimerais également y afficher des informations qui ne sont pas sur la ligne mais dans des cellules a part ( ces information concerne tout le tableau ).
Voila mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| Private Sub COMBOBOX1_Change()
Dim Cell As Range
Dim Usd As Long
Usd = ComboBox1.Value
For Each Cell In Sheets("MODELE FICHE (3)").Range("numligne")
If Cell.Value = Usd Then
With DTPicker1
.Value = Cell.Offset(0, 1).Value
.Enabled = True
End With
With TextBox1
.Value = Cell.Offset(0, 14).Value
.Enabled = True
End With
With ComboBox2
.Value = Cell.Offset(0, 2).Value
.Enabled = True
End With
With TextBox2
.Value = Cell.Offset(0, 3).Value
.Enabled = True
End With
With TextBox3
.Value = Cell.Offset(0, 4).Value
.Enabled = True
End With
With TextBox4
.Value = Cell.Offset(0, 5).Value
.Enabled = True
End With
With TextBox5
.Value = Cell.Offset(0, 6).Value
.Enabled = True
End With
With TextBox6
.Value = Cell.Offset(0, 8).Value
.Enabled = True
End With
With TextBox7
.Value = Cell.Offset(0, 9).Value
.Enabled = True
End With
With TextBox7
.Value = Cell.Offset(0, 9).Value
.Enabled = True
End With
With ComboBox4
.Value = Range("M3")
.Enabled = True
End With
With ComboBox3
.Value = Range("M2").Value
.Enabled = True
End With
With ComboBox5
.Value = Cell.Offset(0, 12).Value
.Enabled = True
End With
With TextBox8
.Value = Cell.Offset(0, 13).Value
.Enabled = True
End With
Exit For
End If
Next Cell
Cancel = True
End Sub |
CE code ne marche pas, un message d'erreur me désigne les lignes du code en rouge comme l'origine de l'erreur. Je penses que j'ai du mal écrire ces lignes mais je ne trouve pas la solution.