Macro to Count Every X amount of Rows

rjacmuto32

Board Regular
Joined
Jul 14, 2004
Messages
98
I have 101 rows of data with row 1 being my header row. I want to do a macro to highlight every 10 rows all the way to the end. So I want rows 11,21,31,etc to be highlighted. How do I do that?

Thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Why do you need a macro? Why not use Conditional Formatting?

With Conditional Formatting:

Select your entire range, i.e. A1:IV101

Click on Format, then Conditional Formatting
Under Condition 1, change Cell Value Is to Formula Is and put in the following formula:
=MOD(ROW(),11)=0
Click on Format
Click on Patterns
Select a color
Click OK
Click OK
 

rjacmuto32

Board Regular
Joined
Jul 14, 2004
Messages
98
Forgot to add this

Besides highlighting I would also like to copy column B of every 10th row into a new worksheet. If i conditional format the cells for that, how do i use a macro to copy cell B11,B21,B31 etc.
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Sorry,

try this formula instead:

=MOD(MAX(ROW(),2)-1,10)=0
 

Forum statistics

Threads
1,171,063
Messages
5,873,558
Members
432,984
Latest member
WilMel

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