Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Bottom border for each row code not working

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Bottom border for each row code not working

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Bottom border for each row code not working

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Bottom border for each row code not working

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
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
Border at bottom of worksheet Terry Excel Discussion (Misc queries) 3 May 17th 07 08:51 PM
Apply bottom border only on filled cells, leaves blank cells without border? StargateFan[_3_] Excel Programming 4 April 8th 07 05:39 PM
Repeat bottom Border Scafidel Excel Discussion (Misc queries) 3 August 29th 06 05:37 AM
Bottom double border from toolbar-customize format not working Tab Excel Discussion (Misc queries) 1 August 16th 06 09:05 PM
Bottom Border along Pagebreak not working properly alex Excel Programming 0 October 23rd 05 07:25 AM


All times are GMT +1. The time now is 10:38 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"