VBA code to remove vertical black boarders

bootj1234

Board Regular
Joined
Aug 27, 2012
Messages
85
I would appreciate assistance with VBA code that would eliminate the vertical black boarders that I show outlined in red in the following image.

I am trying to write code that would use the words in column A, “ADD”, “REMOVE”, “KEEP – Paid Advertisers” as the text that would indicate the starting point for the rows that needed to have the vertical black boarders removed.

Thanks for the assistance.

-John

10f2b0n.png
[/IMG]
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I think this macro may do what you want...
Code:
[table="width: 500"]
[tr]
	[td]Sub RemoveVerticalBorders()
  Dim R As Long, CellVal As String
  For R = 12 To Cells(Rows.Count, "A").End(xlUp).Row
    CellVal = Cells(R, "A").Value
    If CellVal = "ADD" Or CellVal = "REMOVE" Or CellVal = "KEEP - Paid Advertisers" Then
      Intersect(Rows(R), Range("A:K")).Borders(xlInsideVertical).LineStyle = xlLineStyleNone
      Intersect(Rows(R), Range("L:Q")).Borders(xlInsideVertical).LineStyle = xlLineStyleNone
    End If
  Next
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Rick,

Thanks for the prompt reply and code!

I never would have figured this out. Your solution is working great and will save me a lot of time in the future.

Best regards,

-John
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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