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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,227
Messages
6,170,847
Members
452,361
Latest member
d3ad3y3

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