Can anybody help to find out why the data cant be retrieved in the userform? i was stuck with the problem~.~
Can anybody help to find out why the data cant be retrieved in the userform? i was stuck with the problem~.~
Private Sub TextBox0_Change() Dim i As Long If TextBox0.ListIndex > -1 Then i = TextBox0.ListIndex With Sheets("OSH").Range("B6") TextBox1.Value = .Offset(i, 1).Value TextBox2.Value = .Offset(i, 2).Value TextBox3.Value = .Offset(i, 3).Value TextBox4.Value = .Offset(i, 4).Value End With Else TextBox1.Value = "" TextBox2.Value = "" TextBox3.Value = "" TextBox4.Value = "" End If End Sub Private Sub CommandButton1_Click() Dim i As Long If TextBox0.ListIndex > -1 Then i = TextBox0.ListIndex With Sheets("OSH").Range("B6") .Offset(i, 1).Value = TextBox1.Value .Offset(i, 2).Value = TextBox2.Value .Offset(i, 3).Value = TextBox3.Value .Offset(i, 4).Value = TextBox4.Value End With MsgBox "Record Updated" Unload Me Else MsgBox "No name selected. ", , "Invalid Name" End If End Sub
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
Dear AlphaFrog
Thank you very much!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks