Hakim Ullah
New Member
I have created a macro
Hi,I have 3 problems. 1st is with Vlookup.
I am uploading screenshots along with the workbook. Please go to 'find student button' in the 'interface' worksheet. It shows the error '1004'. Please if you can help me. And the second issue is with the 'Edit Record Button'. I have inseted this to edit the recoded data. But it doesn't load the data in the remaining textboxes as I have added the code to load the recorded data.
studentname = WorksheetFunction.VLookup(CLng(ComboBox1), Sheets("Details").Range("A:N"), 2, False)
hI,Thank you Mr.Mike... Your code was very helpful. And is working properly. If you please help me with 'Edit record button' as well. I have inserted that form to edit the recorded data in the 'Details' worksheet. It doesn't load the data in the userform when I enter the regstration number. Please if you help me out.
Sub EditAdd()
Dim TheRow As Long
Dim emptyRow As Long
If frmeditrecord.editstudent1.Value <> "" Then
flag = False
ID = CLng(frmeditrecord.editstudent1.Value)
emptyRow = Sheets("Details").Cells(Rows.Count, "A").End(xlUp).Row + 1
On Error Resume Next
TheRow = Application.Match(ID, Sheets("Details").Columns(1), 0)
On Error GoTo 0
If TheRow > 0 Then
flag = True
For j = 2 To 13
Sheets("Details").Cells(TheRow, j).Value = frmeditrecord.Controls("editstudent" & j).Value
Next j
End If
If flag = False Then
For j = 1 To 13
Cells(emptyRow, j).Value = frmeditrecord.Controls("editstudent" & j).Value
Next j
End If
End If
End Sub
Hi,Dear Mr.Mike, I once again owe you humble thanks. Your help is always helpful to me. The edit sub is working 100%. But if you please help me with the GetData sub. Thats what I am not getting properly. Thank you so much.
Try it again, there was a change event that was calling code at the wrong timeI have uploaded the file which I had practiced. And I am following that codes. When you enter the ID number which is already recorded, it loads all the textboxes with the relevant data. Your help is fully working. But I want to apply the GetData sub as well.