combobox et mise à jour

R

rameaux

Guest
Bonjour,

Dans 1 Userfor1, j'ai un combobox1 "range A", un textbox1 "rangeB" le 2e se mettant à jour automatiquement avec le choix du 1er, par contre je voudrai avoir d'autres textbox2 et 3 "range C,D ...)" que je veux mettre à jour via Userform.

Voici ce que j'ai essayé, mais il y a un problème avec la textbox1

Private Sub UserForm_Initialize()
Dim Plage As String

With Sheets("SAISIE")
Plage = .Range("a2:V100").Address

End With

With ComboBox1
.RowSource = "SAISIE!" & Plage
End With

End Sub

Private Sub ComboBox1_Change()
'mes prénoms mise à jour par combobox1
TextBox12 = ComboBox1.Column(1, ComboBox1.ListIndex)


'mes résultats à mettre à jour
TextBox2 = ComboBox1.Column(14, ComboBox1.ListIndex)
TextBox3 = ComboBox1.Column(15, ComboBox1.ListIndex)

End Sub

Private Sub CommandButton2_Click()

Unload UserForm5

End Sub


'Private Sub UserForm_Activate()

'Application.ScreenUpdating = False

'Sheets("SAISIE").Select
'Range("a2").Select
'For a = 2 To 1500
'NDOS = Cells(a, 1)
'& " " & Cells(a, 2).Value
'ComboBox1.AddItem (NDOS)
'Next
' Application.ScreenUpdating = True
'End Sub
Private Sub CommandButton1_Click()

Sheets("SAISIE").Select


Application.ScreenUpdating = False
CHAINE = ComboBox1

Sheets("SAISIE").Select
Columns("a:a").Select
Selection.Find(What:=CHAINE, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate

y = ActiveCell.Offset(0, 3).Select
ActiveCell = TextBox2
ActiveCell.Offset(0, 1).Select
ActiveCell = TextBox3
ActiveCell.Offset(0, 1).Select


ComboBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""


Application.ScreenUpdating = True

'UserForm5.Hide
Unload UserForm5
UserForm5.Show
End Sub

meci du coup de main!
JM
 
R

Robert

Guest
Bonsoir JM, bonsoir le forum,

Il n'y a pas de TextBox1 dans ton code ci-dessous ! Soit tu as oublié de mette la ligne, soit tu n'as pas vu que tu avais écrit TextBox12 (textbox douze) au lieu de TextBox1... Soit c'est moi qui n'ai rien compris mais rassure toi, ça m'arrive souvent...

Private Sub ComboBox1_Change()
'mes prénoms mise à jour par combobox1
TextBox12 = ComboBox1.Column(1, ComboBox1.ListIndex)
'mes résultats à mettre à jour
TextBox2 = ComboBox1.Column(14, ComboBox1.ListIndex)
TextBox3 = ComboBox1.Column(15, ComboBox1.ListIndex)
End Sub

À plus,

Robert
 

Discussions similaires

Réponses
6
Affichages
321

Statistiques des forums

Discussions
312 751
Messages
2 091 657
Membres
105 036
dernier inscrit
Jeromelemaire