Programming for Everybody: 2026

search button in userform Excel and display all data in one label With Source Code



 Source Code:

Private Sub CommandButton1_Click()

If TextBox1.Text = "" Then

MsgBox "Please Enter ID"

Exit Sub

End If

Dim ws As Worksheet

Set ws = ThisWorkbook.Sheets("Sheet6")

Dim i As Integer

For i = 1 To ws.UsedRange.Rows.Count

If TextBox1.Text = ws.Cells(i, 1).Value Then

Label2.Caption = "First name: " & ws.Cells(i, 2).Value & vbCrLf & "" _

& "Last name: " & ws.Cells(i, 3).Value & vbCrLf & "" _

& "Marks: " & ws.Cells(i, 4).Value

Exit Sub

Else

Label2.Caption = "No data found"

End If

Next i

End Sub



Microsoft Access Form: update button in access form VBA With Code


Full Code:
Option Compare Database

Private Sub Combo0_Click()
Me.id_txt = Me.Combo0.Column(0)
Me.name_txt = Me.Combo0.Column(1)
Me.grade1 = Me.Combo0.Column(2)
Me.marks_txt = Me.Combo0.Column(3)
Me.status1 = Me.Combo0.Column(4)
End Sub

Private Sub Command14_Click()
Dim gradesql As String
If Me.grade1.ListIndex = -1 Then
gradesql = ""
Else
gradesql = "id_grade = " & Me.grade1.Column(0) & ", "
End If
CurrentDb.Execute "Update marks_students2 Set " & _
"student_name = '" & Me.name_txt & "', " & _
gradesql & _
"marks = " & Me.marks_txt & ", " & _
"status1 = '" & Me.status1.Value & "' " & _
" Where id = " & Me.id_txt
MsgBox "Data Updated Successfull"
End Sub

Show and hide password in column datagridview in C#

🔍 Searching and selecting records efficiently inside an Excel VBA UserForm can significantly improve user experience.

🎯 In this tutorial, I demonstrate how to implement a dynamic search feature using a TextBox and display filtered results in a ListBox. Selecting a row automatically populates the UserForm fields with the corresponding data, making data editing and navigation faster and more reliable.

📺 Full tutorial on YouTube:

#Microsoft #ExcelVBA #VBA #UserForm #Automation #TechCommunity