Fill Across Border Settings

FrenchCelt

Board Regular
Joined
May 22, 2018
Messages
214
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to code a border setting that will carry across the entire range of data. I'll give the starting point from Column A:

Thick Outside Border around A2
Thick Outside Border around A3:A9
All Borders (Thin Lines) within A10:A13
Thick Outside Border around A10:A15

And then these settings should fill across to the end of the data in whatever column that may be (varies every day).

Any help would be greatly appreciated.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Is the last column always the same for each of the parameters that you have listed?
 
Upvote 0
I am not asking if the last column varies on each report, I am asking if the last column is the same for each parameter when the report is run i.e.
If the last column is column G for "Thick Outside Border around A2" when the report is run is it also column G for the other 3 parameters or are they different for each parameter?
 
Upvote 0
Oh, yes, the data is identical in every row for every column.
 
Upvote 0
Maybe...
VBA Code:
Sub FrenchCelt()
    Dim i As Long

    i = Rows("2:15").Find("*", , xlValues, xlPart, xlByColumns, xlPrevious, False).Column

    Rows("2:15").Borders.LineStyle = xlNone
    Range(Cells(2, "A"), Cells(2, i)).BorderAround , Weight:=xlThick
    Range(Cells(3, "A"), Cells(9, i)).BorderAround , Weight:=xlThick
    Range(Cells(10, "A"), Cells(13, i)).Borders.Weight = xlThin
    Range(Cells(10, "A"), Cells(15, i)).BorderAround , Weight:=xlThick

End Sub
 
Upvote 0
It ended up filling the borders around the entirety of the rows, not in each cell range per column. I want to distinguish the data in these sections in each column. The slow way to do this, for example, would be to click on A2 and click on Thick Outside Borders, then do the same for B2, C2, D2, E2, etc. Then select A3:A9, click on Thick Outside Borders, then repeat for B3:B9, C3:C9, etc.
 
Upvote 0
VBA Code:
Sub FrenchCelt2()
    Dim i As Long

    i = Rows("2:15").Find("*", , xlValues, xlPart, xlByColumns, xlPrevious, False).Column

    Rows("2:15").Borders.LineStyle = xlNone
    Range(Cells(2, "A"), Cells(2, i)).Borders.Weight = xlThick
    Range(Cells(3, "A"), Cells(9, i)).Borders.Weight = xlThick
    Range(Cells(10, "A"), Cells(13, i)).Borders.Weight = xlThin
    Range(Cells(10, "A"), Cells(15, i)).Borders.Weight = xlThick

End Sub

Although that doesn't make any sense with your last 2 criteria, are you sure that the last criteria isn't Thick Outside Border around A14:A15

I think that I will require a screenshot of what you are trying to achieve as I suspect that you only want the borders around cells with data in them.
 
Last edited:
Upvote 0
This time it added thick borders around every cell in every row and column.
 
Upvote 0

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

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