• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6
  • Last Modified:

Macro to alternate row color based on values in column A

Does anyone know of a simple Macro to alternate the row colour in Excel when the value in column A changes?

The attached file shows an example of what I want to achieve.
  • 2
1 Solution
NorieVBA ExpertCommented:
No file attached I'm afraid.
HKFueyAuthor Commented:
Screen Shot
Rob HensonFinance AnalystCommented:
You don't need VBA for that, you can use Conditional Formatting.

Insert a spare column in column A and enter the following formula, starting at row 2 and copy down as required:


This will then number each set of rows with 1 or 0. You can then use the 1 or 0 as a check value for Conditional Formatting.

See attached.

Column A can then be hidden if required.
HKFueyAuthor Commented:
In the absence of any other solutions, you get the points!

I used some SQL to add a formatting column to the data output, then conditional formatting.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now