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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

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,136,708
Messages
5,677,317
Members
419,687
Latest member
ash59

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