Posts

Showing posts from January, 2025

Auto Highlight Entire Row & Cell in Excel

Auto Highlight Entire Row & Cell in Excel Objective : Highlight an entire row in Excel based on a condition using VBA. Step 1: Define the Requirement Use Conditional Formatting rule: = CELL("Row")=ROW() Step 2: Write VBA Code (in View Code) Private Sub Worksheet_SelectionChange(ByVal Target As Range) ActiveCell.Calculate End Sub Observe the Result : The entire row corresponding to the selected cell will be highlighted. The row will be highlighted in yellow (or other colors based on your preference). Key Notes: The row will automatically highlight based on the condition. This process works without the need for manual intervention once the macro is run. Process Flow 2: Auto Recalculate Active Cell Objective : Recalculate the formula in the active cell using VBA. Step 1: Write the Conditional Ruling =CELL("address")=CELL("address",A1) Step 2: Process Flow Step 2: Write VBA Code (in View Code) Private Sub Worksheet_SelectionChange(ByVal Target As Range) Ac...

Difference between the DISTINCT and UNIQUE functions:

Difference between the DISTINCT and UNIQUE functions: Suppose we have a list of scores: | Name | Score | | --- | --- | | John | 90 | | Mary | 80 | | John | 90 | | David | 70 | | Mary | 80 | | Emma | 95 | We want to analyze the scores using the DISTINCT and UNIQUE functions: DISTINCT Function =DISTINCT(B2:B7) Result: | Score | | --- | | 90 | | 80 | | 70 | | 95 | The DISTINCT function returns all the unique scores. UNIQUE Function =UNIQUE(B2:B7) Result: | Score | | --- | | 70 | | 95 | The UNIQUE function returns only the scores that appear only once. In this example: - The score 90 appears twice, so it's not included in the UNIQUE result. - The score 80 appears twice, so it's not included in the UNIQUE result. - The scores 70 and 95 appear only once, so they're included in the UNIQUE result. This example shows the difference between the DISTINCT and UNIQUE functions: - DISTINCT returns all unique values. - UNIQUE returns only the values that appear only once.