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.
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
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.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,782
Office Version
  1. 2010
Platform
  1. Windows
So what rows(s) should be highlighted?
 

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27

ADVERTISEMENT

The bottom border of each cell every few rows down need to be darkened.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,782
Office Version
  1. 2010
Platform
  1. Windows
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:

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,782
Office Version
  1. 2010
Platform
  1. Windows
You're welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,970
Messages
5,599,108
Members
414,288
Latest member
horizon2

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