PC Review


Reply
Thread Tools Rate Thread

Bottom border for each row code not working

 
 
=?Utf-8?B?R3dlbg==?=
Guest
Posts: n/a
 
      16th Jul 2007
I would like a bottom border For each row on the sheet from columns a:l
For some reason this code does not work.
What am I missing?

Dim x As Integer
Dim lastrow As Long

lastrow = Range("A65536").End(xlUp).Row

For x = 7 To lastrow
ActiveCell.Columns("A:L").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone

With Selection.Borders(xlEdgeBottom)

.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone

next x


Thanks
 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      16th Jul 2007
is all you want a bottom border from in columns a:L from row 7 to the lastrow?

Sub test()
Dim x As Integer
Dim lastrow As Long
lastrow = Range("A65536").End(xlUp).Row
For x = 7 To lastrow
With Range("A" & x).Resize(1, 12).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Next x

End Sub


--


Gary


"Gwen" <(E-Mail Removed)> wrote in message
news:02C49589-8AD0-4317-AB13-(E-Mail Removed)...
>I would like a bottom border For each row on the sheet from columns a:l
> For some reason this code does not work.
> What am I missing?
>
> Dim x As Integer
> Dim lastrow As Long
>
> lastrow = Range("A65536").End(xlUp).Row
>
> For x = 7 To lastrow
> ActiveCell.Columns("A:L").Select
>
> Selection.Borders(xlDiagonalDown).LineStyle = xlNone
> Selection.Borders(xlDiagonalUp).LineStyle = xlNone
> Selection.Borders(xlEdgeLeft).LineStyle = xlNone
> Selection.Borders(xlEdgeTop).LineStyle = xlNone
>
> With Selection.Borders(xlEdgeBottom)
>
> .LineStyle = xlContinuous
> .Weight = xlThin
> .ColorIndex = xlAutomatic
> End With
>
> Selection.Borders(xlEdgeRight).LineStyle = xlNone
> Selection.Borders(xlInsideVertical).LineStyle = xlNone
>
> next x
>
>
> Thanks



 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      16th Jul 2007
Give this a whirl...

Dim rng As Range

Set rng = Range(cells(Rows.Count, "A").End(xlUp), Range("L7"))
rng.Borders.LineStyle = xlNone
rng.Borders(xlInsideHorizontal).LineStyle = xlContinuous
rng.Borders(xlEdgeBottom).LineStyle = xlContinuous

--
HTH...

Jim Thomlinson


"Gwen" wrote:

> I would like a bottom border For each row on the sheet from columns a:l
> For some reason this code does not work.
> What am I missing?
>
> Dim x As Integer
> Dim lastrow As Long
>
> lastrow = Range("A65536").End(xlUp).Row
>
> For x = 7 To lastrow
> ActiveCell.Columns("A:L").Select
>
> Selection.Borders(xlDiagonalDown).LineStyle = xlNone
> Selection.Borders(xlDiagonalUp).LineStyle = xlNone
> Selection.Borders(xlEdgeLeft).LineStyle = xlNone
> Selection.Borders(xlEdgeTop).LineStyle = xlNone
>
> With Selection.Borders(xlEdgeBottom)
>
> .LineStyle = xlContinuous
> .Weight = xlThin
> .ColorIndex = xlAutomatic
> End With
>
> Selection.Borders(xlEdgeRight).LineStyle = xlNone
> Selection.Borders(xlInsideVertical).LineStyle = xlNone
>
> next x
>
>
> Thanks

 
Reply With Quote
 
=?Utf-8?B?R3dlbg==?=
Guest
Posts: n/a
 
      16th Jul 2007
Works Perfectly
Thank all of you for your time and assistance.

"Jim Thomlinson" wrote:

> Give this a whirl...
>
> Dim rng As Range
>
> Set rng = Range(cells(Rows.Count, "A").End(xlUp), Range("L7"))
> rng.Borders.LineStyle = xlNone
> rng.Borders(xlInsideHorizontal).LineStyle = xlContinuous
> rng.Borders(xlEdgeBottom).LineStyle = xlContinuous
>
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Gwen" wrote:
>
> > I would like a bottom border For each row on the sheet from columns a:l
> > For some reason this code does not work.
> > What am I missing?
> >
> > Dim x As Integer
> > Dim lastrow As Long
> >
> > lastrow = Range("A65536").End(xlUp).Row
> >
> > For x = 7 To lastrow
> > ActiveCell.Columns("A:L").Select
> >
> > Selection.Borders(xlDiagonalDown).LineStyle = xlNone
> > Selection.Borders(xlDiagonalUp).LineStyle = xlNone
> > Selection.Borders(xlEdgeLeft).LineStyle = xlNone
> > Selection.Borders(xlEdgeTop).LineStyle = xlNone
> >
> > With Selection.Borders(xlEdgeBottom)
> >
> > .LineStyle = xlContinuous
> > .Weight = xlThin
> > .ColorIndex = xlAutomatic
> > End With
> >
> > Selection.Borders(xlEdgeRight).LineStyle = xlNone
> > Selection.Borders(xlInsideVertical).LineStyle = xlNone
> >
> > next x
> >
> >
> > Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
page border problems bottom border missing mikeeeee Microsoft Word Document Management 0 12th Oct 2009 09:31 AM
Bottom double border from toolbar-customize format not working =?Utf-8?B?VGFi?= Microsoft Excel Misc 1 16th Aug 2006 09:05 PM
Bottom Border along Pagebreak not working properly =?Utf-8?B?YWxleA==?= Microsoft Excel Programming 0 23rd Oct 2005 07:25 AM
Body of page appears in Top Border, Left Border and Bottom Border (there is no right border) Michael Edwards Microsoft Frontpage 1 14th Oct 2004 09:46 AM
Bug?--Excel 2003 Bottom Double Border tool not working Roy Microsoft Excel Misc 4 3rd Jan 2004 09:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:19 PM.