VBA code needed! Darkening the bottom line of a cell every couple of rows.

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
Hello all...

I'm stumped on this code when using a counter for a range of cells.

What I'm needing is to darken every couple of of rows at the bottom of the cell, columns A through P, making it easier to read when printed out. I can't do this manually because this particular spreadsheet compiles information on a daily basis, and I have a macro to delete all the contents once the spreadsheet is opened. There is no fixed range for this, just depends on what is being compiled from the other spreadsheets.

Any help would be appreciated.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
That will not work...the conditional formatting is deleted everytime I open the spreadsheet to run the new report. And I also have shading on certain cells so that will be confusing.
Thanks.
 
Upvote 0
So what rows(s) should be highlighted?
 
Upvote 0
Code:
Sub BottomBorderEveryFewRows()
    Const aFew As Long = 3
    Dim iRow As Long
    
    For iRow = aFew To Cells(Rows.Count, "A").End(xlUp).Row Step aFew
        Rows(iRow).Range("A1:P1").Borders(xlEdgeBottom).Weight = xlThin
    Next iRow
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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