Insert xlBottom border to group data

F

Forgone

I'm trying to create a macro that will insert a border on the bottom
row if the data in a specific column stops being duplicated and need a
hand doing it.

In one of the columns, I have data that can be duplicated and all I
need to do is to modify the existing border (dotted line grey) to a
solid black line.

So far, I've started with......

Sub InsertBorderToGroupItems()
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1,0).Value
Offsetcount = 1

Do while Activecell <> ""
If FirstItem <> SecondItem Then ' this is where the 2 shall differ
With ActiveCell.Offset(Offsetcount, 0)
..........

The column that its going to be checking is column "F"

However, I need the border to be inserted from Column A to Column S
(for now)
I was thinking of......

With ActiveCell.Offset(Offsetcount,0)
ActiveRow.Select
.... insert border

Any assistance would be sincerely appreciated.
 
P

Peter T

If I follow what you are after, try something like this

Sub InsertBottomBdr()
Dim nRow As Long, nFromCol As Long, nToCol As Long
Dim nCol As Long
Dim rng As Range

nRow = ActiveCell.Row
nFromCol = 1
nToCol = Range("S1").Column

Set rng = Range(Cells(nRow, nFromCol), Cells(nRow, nToCol))

With rng.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With

End Sub

If always A to S simply
Set rng = Range(Cells(nRow, 1), Cells(nRow, 19))

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VLOOKUP Insert & Copy 24
I need help with macro 3
Macro & VB101 and Excel 3
Border formatting row of cells 22
Insert Border 2
Excel hangs 1
Can Vba workout if a selection is part of a group? 0
Limit .find to one pass 8

Top