Changing the colour of the cells based on rules using VBA macros

Zafirah_Iqbal

New Member
Joined
Mar 13, 2017
Messages
1
Hi,

I'm new to VBA. I need a VBA macro which can change the colour of the cells based on rules applied.

B1B2B3B4B5
0.00a0.00a0.00a0.00a0.00a
0.01a0.02a0.00a0.00a0.00a
0.03b0.01ab0.00a0.00a0.00a
0.06a0.03a0.07a0.04a0.06a
0.15a0.18ab0.27b0.26b0.22ab

<tbody>
</tbody>

Rules are
  • Any alphabet which is present in criteria column (B1) should not be highlighted in B2,B3 and B4
  • Any alphabet which is greater than the criteria (B1) should be highlighted in Green for B2,B3 and B4 . For eg : A is greater than B
  • Any alphabet which is lesser than the criteria (B1) should be highlighted in Red for in B2,B3 and B4. For eg: A and B are lesser than C

Thanks for your help !!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,216,434
Messages
6,130,597
Members
449,584
Latest member
c_clark

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top