Insert Border When A Value Changes

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,502
Office Version
  1. 2016
Platform
  1. Windows
Hello Friends,

I am using the below code ( i found it on the web) to insert a border from Column A to L whenever a value changes in column B.

Code:
Sub Test()      
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim rng As Range
    For Each rng In Range("B4:B" & LastRow)
        If rng <> rng.Offset(1, 0) Then
            Range("A" & rng.Row & ":L" & rng.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous
            
            
            
        End If
    Next rng
  
End Sub


What i want is a thick border line whereas the code is inserting a thin line. I am sure a small change is needed in the code but i am unable to do it.

Any help would be appreciated.

Regards,

Humayun
 
think i should start a new thread clearly mentioning as the problem of the current thread is solved

You are right ...:)
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,216,113
Messages
6,128,903
Members
449,477
Latest member
panjongshing

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