Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Insert xlBottom border to group data

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Insert xlBottom border to group data

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

"Forgone" wrote in message
...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert xlBottom border to group data


I note that the your code starts at the active cell, but later you say
you're checking column F, so for it to work properly you *have* to
select a cell in column F. In the code below, the commented-out line
beginning 'Set cll =' is a way to select a cell in any column and the
code will still use column F and check from that row
downwards.Sub blah()
Set cll = ActiveCell
'Set cll = Cells(ActiveCell.Row, "F") 'optional line to replace one
above
Do While cll < ""
If cll.Value < cll.Offset(1).Value Then
With Range(Cells(cll.Row, "A"), Cells(cll.Row,
"S")).Borders(xlEdgeBottom)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
End If
Set cll = cll.Offset(1)
Loop
End Sub


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=134347

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Group box border visibility control teishin Excel Discussion (Misc queries) 2 October 31st 06 06:51 PM
Macro to sort data, insert a line after each group & then total? karinmpfa Excel Programming 0 April 25th 06 01:11 AM
border color in forms group box Yvette Excel Discussion (Misc queries) 1 December 10th 04 11:13 PM
format border by group jackie Excel Programming 6 May 27th 04 09:43 PM
Group Box Border Jason Excel Programming 6 March 6th 04 04:10 AM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"