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
How to update column from another column with condition in same table in...
🔍 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