nidhipatel
Board Regular
- Joined
- Feb 11, 2017
- Messages
- 52
My userform contain 6 TextBox (TextBox1 To TextBox6)
listBox1
3 macro contain
1 – TextBox Data Transfer To Listbox
2 – Dobule Clcik To Listobx For Edit ListBox Data and show in Reseptivly Textboxs
3 - Update Data Show in ListBox
Macro 1
Is run in Textbox6 KeyDown Event If Key Code = 13 then data Transfer to Listbox)
Macro 3
Is also run in Textbox6 KeyDown Event If Key Code = 13 then updated data show in listbox
In short macro 1 and macro 3 both is run in textbox 6 Keydown event
My code I below given error how it fix
Private Sub TextBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim i As Integer
With UserForm1
For i = 1 To .ListBox1.ListCount - 1
If .ListBox1.Selected(i) And KeyCode = 13 Then
.ListBox1.List(i, 0) = .TextBox1
.ListBox1.List(i, 1) = .TextBox2
.ListBox1.List(i, 2) = .TextBox3
.ListBox1.List(i, 3) = .TextBox4
.ListBox1.List(i, 4) = .TextBox5
.ListBox1.List(i, 5) = .TextBox6
Else
Call Module3.TextBox_Data_To_List_Box
End If
Next i
End With
End Sub
listBox1
3 macro contain
1 – TextBox Data Transfer To Listbox
2 – Dobule Clcik To Listobx For Edit ListBox Data and show in Reseptivly Textboxs
3 - Update Data Show in ListBox
Macro 1
Is run in Textbox6 KeyDown Event If Key Code = 13 then data Transfer to Listbox)
Macro 3
Is also run in Textbox6 KeyDown Event If Key Code = 13 then updated data show in listbox
In short macro 1 and macro 3 both is run in textbox 6 Keydown event
My code I below given error how it fix
Private Sub TextBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim i As Integer
With UserForm1
For i = 1 To .ListBox1.ListCount - 1
If .ListBox1.Selected(i) And KeyCode = 13 Then
.ListBox1.List(i, 0) = .TextBox1
.ListBox1.List(i, 1) = .TextBox2
.ListBox1.List(i, 2) = .TextBox3
.ListBox1.List(i, 3) = .TextBox4
.ListBox1.List(i, 4) = .TextBox5
.ListBox1.List(i, 5) = .TextBox6
Else
Call Module3.TextBox_Data_To_List_Box
End If
Next i
End With
End Sub