Check for Missing Borders - VBA

Bablu

Board Regular
Joined
Dec 9, 2008
Messages
131
Office Version
  1. 2016
Platform
  1. Windows
Hello All-

I am trying to identify quickly where I am missing part of the Border. There are a lot of rows, so if I could have it somewhat automated, it will save me a lot of headache.

As an example below the Red color is where I am missing the part of the border where I need to identify the border is missing.

Any guidance would be great. Thanks in advance!

Capture.PNG
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
More info required here ?
Are they merged cells between cols C and D ?
How did you put the borders in place, Manually or via code ??
 
Upvote 0
This might do the trick. If this does work you can change the code to put the border in instead of highlighting it red.

VBA Code:
Sub MissingBorder()
Dim r As Range: Set r = Range("A1:K30")

For Each cel In Selection
    If cel.Offset(, 1).Borders.Item(4).LineStyle = 1 And cel.Borders.Item(4).LineStyle <> 1 Then cel.Interior.ColorIndex = 3
Next cel
End Sub
 
Upvote 0
More info required here ?
Are they merged cells between cols C and D ?
How did you put the borders in place, Manually or via code ??

Hi-

There are merged cells within the sheet; However, the ones I need to compare are not merged cells, so C and D are not merged cells.
The Borders are put in manually.
 
Upvote 0
This might do the trick. If this does work you can change the code to put the border in instead of highlighting it red.

VBA Code:
Sub MissingBorder()
Dim r As Range: Set r = Range("A1:K30")

For Each cel In Selection
    If cel.Offset(, 1).Borders.Item(4).LineStyle = 1 And cel.Borders.Item(4).LineStyle <> 1 Then cel.Interior.ColorIndex = 3
Next cel
End Sub

Sorry, this is not doing anything on my sheet. I tried changing the ranges around, but no avail.
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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