Home > excel, Learning, Lesson, Problem, Projects/Experiments > Excel, VBA Codes and Formulas-4

Excel, VBA Codes and Formulas-4


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.



Steps
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




  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: