This project demonstrates how to use Excel VBA and ActiveX Controls to create a functional and automated Employee Record Search System.
It combines clean data management, user-friendly search capability, and dynamic column formatting β all within Microsoft Excel.
.xlsm for VBA compatibility.Before running any VBA macros, ensure that Excel can execute ActiveX components safely.
| Sheet Name | Purpose |
|---|---|
| Search Interface | User search input and results display |
| EmployeeData | Holds full dataset (31 columns, starting from Row 1) |
TextBox1) and a CommandButton (CommandButton1) on the Search Interface sheet.Private Sub CommandButton1_Click()
Dim wsData As Worksheet, wsSearch As Worksheet
Dim searchValue As String
Dim lastRow As Long, destRow As Long
Dim cell As Range, rng As Range
Set wsData = ThisWorkbook.Sheets("EmployeeData")
Set wsSearch = ThisWorkbook.Sheets("Search Interface")
searchValue = Trim(wsSearch.TextBox1.Text)
If searchValue = "" Then
MsgBox "Please enter a search term.", vbExclamation
Exit Sub
End If
wsSearch.Rows("7:" & wsSearch.Rows.Count).ClearContents
lastRow = wsData.Cells(wsData.Rows.Count, "A").End(xlUp).Row
Set rng = wsData.Range("A2:A" & lastRow)
destRow = 7
For Each cell In rng
If InStr(1, cell.Value, searchValue, vbTextCompare) > 0 _
Or InStr(1, cell.Offset(0, 1).Value, searchValue, vbTextCompare) > 0 Then
cell.EntireRow.Copy wsSearch.Cells(destRow, "A")
destRow = destRow + 1
End If
Next cell
If destRow = 7 Then
MsgBox "No matching records found.", vbInformation
Else
MsgBox "Search completed.", vbInformation
End If
End Sub
(Paste this into the βSearch Interfaceβ sheet module)
Private Sub Worksheet_Activate()
Cells.EntireColumn.AutoFit
End Sub
EmployeeData (Sheet2).Search Interface (Sheet1) starting from Row 7.This setup is ideal for HR dashboards, employee directories, or data filtering tools.
πΊ 
(Click image to view recorded demo)
Demo preview is shown in the linked screenshot above.
| Search Interface | Results Display |
|---|---|
![]() |
![]() |
Excel-Employee-Search-VBA/
β
βββ README.md
βββ EmployeeSearch.xlsm
βββ results_display.png
βββ screenshots/
βββ search_interface.png
βββ results_display.png
Badawi Aminu Muhammed
Data Analyst | Business Intellince Specialist | Researcher Scientist
π§ cigma.generalsolutions@gmail.com
π linkedin.com/in/elameenbadawy
Cigma General Solutions β "β¦significant difference"
.xlsm file.Excel VBA β’ ActiveX Controls β’ Automation β’ Data Cleaning β’ Search Function β’ HR Analytics