bold every 5th line and number every 5th line

travizwebb1

New Member
Joined
May 26, 2011
Messages
2
Hello,

I'm using Excel 2007, I need a macro that will bold every 5th row and number 5th row, starting by number 1.

The numbering of every 5th row needs to start in B1. The bolding of every 5th row also needs to start in row 1
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the board...

You may be better off using conditional formatting for this..
If you use a macro to do it, and then for any reason insert or delete row(s), then your pattern is off.

What version of Excel do you have?
 
Upvote 0
Try this...

In A1, or whatever column you want the numbering...

=IF(MOD(ROW(),5)=1,ROUNDUP(ROW()/5,0),"")
And fill it down as far as needed.


Then highlight your ENTIRE range that you want the formatting applied to..
Click Conditional Formatting
New Rule
Use a Formula

Put the formua
=MOD(ROW(),5)=1

Apply your bolding format
And apply - ok..


Hope that helps.
 
Upvote 0
Try this...

In A1, or whatever column you want the numbering...

=IF(MOD(ROW(),5)=1,ROUNDUP(ROW()/5,0),"")
And fill it down as far as needed.

I think you can simplify your formula a little to this...

=IF(MOD(ROW(),5)=1,(ROW()+4)/5,"")
 
Upvote 0
Yep....Habits...

The roundup is helpfull when you want the # shown in the intermediate cells as well..

A1:A5 = 1
A6:A10 = 2
A11:A16 = 3
etc..
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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