Archive for March 26, 2020

Excel, VBA Codes and Formulas-4

March 26, 2020 Leave a comment

Learn To : In Excel – Highlight the Row when clicked.

Assume we have a table, and all we want to do is that if the user click anywhere in the table that ROW will change it’s color.

1. From the Top menu, Go to “Developer”, then Press Visual Basic.

2. from the select the sheet name containing the table. ( We have it in Sheet 2 )
3. Then we select “SelectionChange” action from the

4. Write this code:
If Not Intersect(ActiveCell, Range(“C8:E9999”)) Is Nothing Then
Range(“A1”).Value = Target.Row

End If

5. You need to know your Table Range, in my example, the range is (“C8:E9999”). I add the “9999” so i will be sure the even if we add more data to out Table the code will handle it.

6. Now we need to add a rule in the “Manage Roles” in “Conditional Formatting” from the Excel Menu. Here is how to Open it.

7. Select the “” then add new Rule, Follow the Image showing the steps to do that. Once we finish it should work fine.

Now, when the user click any cell in the Table the Row will change it’s color (Format) as we set it.

🙂 Have Fun ..

Follow me on Twitter..

By: Ali Radwani