VBA Code Functions Overview
VBA Code Functions Overview
Understanding the
`Worksheet_Change` Event
Your Name
Date
Overview of the Code
• • Purpose:
• - Manage user inputs in specified cells (B3,
D3, B8)
• - Validate inputs, record entries, and highlight
occurrences
• - Provide user feedback and track data in the
worksheet
Function: `Worksheet_Change`
• • Definition:
• - Handles changes in the worksheet.
• • Parameters:
• - ByVal Target As Range: Represents the
range of changed cells.
Input Validation
• • Cells: B3, D3, B8
• • Parameters:
• - cellValue (Variant)
• • Purpose:
• - Checks if input is numeric and between
100000 and 999999
• - Clears cell contents if invalid
Handling Input in Cell B3
• • Parameters:
• - lastRow (Long): Next empty row in column F
• - currentDate (Date): Current date
• • Purpose:
• - Record value from B3 into column F
• - Record date in column E
• - Count occurrences in column F and update
B4
• - Clear B3 after entry
Handling Input in Cell D3
• • Parameters:
• - foundCell (Range): Finds occurrences in
column F
• - firstAddress (String): First found cell's
address
• • Purpose:
• - Search for value in column F
• - Highlight found cell in red
• - Write 'Received by KYC' in column G
Handling Input in Cell B8
• • Parameters:
• - foundCell (Range)
• - firstAddress (String)
• • Purpose:
• - Search for value in column F
• - Highlight found cell in blue
• - Write 'Received by KYC' in column G
• - Record current date in column H
• - Clear B8 after checking
Summary
• • Functionality:
• - Validates user inputs
• - Tracks data in the worksheet
• - Provides feedback on data processing
• • Example Usage:
• - Entering numbers in B3 records data
• - Searching in D3 or B8 highlights occurrences
Questions
• Open the floor for any questions regarding the
code and its functionality.