VBA to select range of cells down to bottom border - ?????

spydey

Active Member
Joined
Sep 19, 2017
Messages
314
Office Version
  1. 2013
Platform
  1. Windows
Hey, so I will make this fast.

I am looking for a way to select a range of cells, starting with A17, down column A, to where a bottom double line border is.

There are no other bottom borders in the range.

The range can vary, i.e. A17:A46; A17:A2345837, etc etc.

All of the range's cells may or may not be blank or an assortment.

I was hoping for something like (the below is totally made up but hopefully gets the idea across):

Code:
Range("A17").End(xlDown).BottomBorder.Select

Any thoughts, ideas, etc?

Everything I find is telling me how to place and take away borders, which I know, but can't seem to find something on how to make a selection of cells down to the cell that has a bottom border.

Is it even possible?

-Spydey
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Does this get you close to what you need...

Code:
Sub FindDoubleLine()


    Dim rng As Range, rc As Range
    Dim i As Long, lRow As Long
    
    lRow = Cells(Rows.Count, 1).End(xlUp).Row
    Set rng = Range("A17:A" & lRow)
    For Each rc In rng
        If rc.Cells.Font.Underline = -4119 Then
            MsgBox "Double Found at address " & rc.Address
        End If
    Next
    
End Sub
 
Upvote 0
The above code that I posted is looking for a font double underline as opposed to a cell double bottom line.
 
Upvote 0
The above code that I posted is looking for a font double underline as opposed to a cell double bottom line.

Yes, I noticed that.

Thanks for posting.

So basically, once I identify the address of the cell that has a bottom border, I can then plug that in to a range and have the full range from top to bottom (cell with bottom border).

Genius!!

Thanks @igold!!

-Spydey
 
Upvote 0
You're welcome. Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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