#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default BORDERS

I have spreadsheets which vary in number of rows. I want to put a
border around all the records in column b starting at row 2 and to the
bottom of the sheet. Then I want to put another border around column
c through column o also starting at row 2. The columns will not ever
change just the number of rows.

Thanks for the help,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default BORDERS

This will handle columns C-O on one sheet. I leave the rest to you.

Hth,
Merjet

Sub DoBorders()
Dim rng As Range
Dim c As Range
Dim iEnd As Long

iEnd = Sheets("Sheet1").Range("C65536").End(xlUp).Row

'clear any borders in range
Set rng = Sheets("Sheet1").Range("C2:O" & iEnd)
For Each c In rng
c.Borders(xlEdgeTop).LineStyle = xlNone
c.Borders(xlEdgeLeft).LineStyle = xlNone
c.Borders(xlEdgeRight).LineStyle = xlNone
c.Borders(xlEdgeBottom).LineStyle = xlNone
Next c

'add left borders
Set rng = Sheets("Sheet1").Range("C2:C" & iEnd)
For Each c In rng
c.Borders(xlEdgeLeft).LineStyle = xlContinuous
c.Borders(xlEdgeLeft).Weight = xlThick
Next c

'add bottom borders
Set rng = Sheets("Sheet1").Range("C" & iEnd & ":" & "O" & iEnd)
For Each c In rng
c.Borders(xlEdgeBottom).LineStyle = xlContinuous
c.Borders(xlEdgeBottom).Weight = xlThick
Next c

'add right borders
Set rng = Sheets("Sheet1").Range("O2:O" & iEnd)
For Each c In rng
c.Borders(xlEdgeRight).LineStyle = xlContinuous
c.Borders(xlEdgeRight).Weight = xlThick
Next c

End Sub

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
Borders Larry L Excel Discussion (Misc queries) 2 August 11th 09 05:45 PM
borders mhenley5 Excel Discussion (Misc queries) 2 May 5th 09 11:09 PM
borders kim Excel Discussion (Misc queries) 1 October 12th 07 10:24 PM
Borders DAH Mist Excel Discussion (Misc queries) 0 October 1st 07 10:24 PM
Borders Tucker Excel Discussion (Misc queries) 2 May 15th 07 06:41 AM


All times are GMT +1. The time now is 03:11 AM.

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

About Us

"It's about Microsoft Excel"