coloring even row without looping

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
292
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi

I have a lot of worksheet of many workbooks to colour the alternate row. Currently I am doing a loop for each row of each worksheet of each workbook to change the interior colour of odd numbered rows that contains values. It is working well.

However, when i inserted colour change code, this is slowing down the macro a lot. Is there a better way to do the color without looping and affecting performance of the macro?

Thanks,
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

JamesCanale

Board Regular
Joined
Jan 13, 2021
Messages
161
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Use conditional formatting.
MrExcelPlayground.xlsm
ABC
1Emp NameEmp IDGroup
2Emp1a1TET
3Emp2a2TET
4Emp3a3BSD
5Emp4a4GERT
6Emp5a5KPIOT
7Emp6a6TET
8Emp7a7BSD
9Emp8a8GERT
10Emp9a9TET
11Emp10a10BSD
12Emp11a11TET
13Emp12a12BSD
14Emp13a13GERT
15Emp14a14KPIOT
16Emp15a15TET
17Emp16a16BSD
18Emp17a17GERT
19Emp18a18KPIOT
20Emp19a19TET
21Emp20a20BSD
22Emp21a21TET
23Emp22a22BSD
24Emp23a23GERT
25Emp24a24KPIOT
Sheet38
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C25Expression=ISODD(ROW())textNO
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,790
Office Version
  1. 365
Platform
  1. Windows
I think you have 3 options
1) use Conditional formatting
2) convert all the data to Tables & use a suitable table style
3) loop through the data with a macro.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,042
Messages
5,639,716
Members
417,107
Latest member
derekMG

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
Top