Borders for every n'th number of cells

mikec82

Board Regular
Joined
Jan 13, 2009
Messages
225
I've got a sheet with three columns. Data for one individual takes up 10 rows and 3 columns, then it skips 2 lines, and then the next person. I'd like to put "outside borders" around each individuals data and have no borders in between, in order to create more of a gap between each record. Is this possible? It will always be every 10 rows, skip 2, then the next 10 rows, etc.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
If all of your data are constants (that is, no formulas), then you can use this macro (I assumed Column B:D - change as needed)...
Code:
Sub PutBordersAroundCells()
  Dim Ar As Range
  For Each Ar In Columns("[COLOR="#0000FF"][B]B:D[/B][/COLOR]").SpecialCells(xlConstants).Areas
    Ar.BorderAround xlContinuous, xlThick
  Next
End Sub

EDIT NOTE
------------------------------
Actually, as long as each individual section has at least one cell containing a constant, then this should work...
Code:
Sub PutBordersAroundCells()
  Dim Ar As Range
  For Each Ar In Columns("[B][COLOR="#0000FF"]B:D[/COLOR][/B]").SpecialCells(xlConstants).Areas
    Ar.CurrentRegion.BorderAround xlContinuous, xlThick
  Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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